summaryrefslogtreecommitdiff
path: root/samples/obdtest
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2013-06-18 18:00:31 +0800
committerStanley Huang <stanleyhuangyc@gmail.com>2013-06-18 18:00:31 +0800
commit7f33c78305dc61642a223df575d3782d4e9038ca (patch)
treee6da21fb1708db806f4efe790e79fa9261e14241 /samples/obdtest
parent23c78e31d87eaf9555101b19242c6ca8d914b453 (diff)
download2021-arduino-obd-7f33c78305dc61642a223df575d3782d4e9038ca.tar.gz
2021-arduino-obd-7f33c78305dc61642a223df575d3782d4e9038ca.tar.bz2
2021-arduino-obd-7f33c78305dc61642a223df575d3782d4e9038ca.zip
update OBD tester
Diffstat (limited to 'samples/obdtest')
-rw-r--r--samples/obdtest/obdtest.ino50
1 files changed, 21 insertions, 29 deletions
diff --git a/samples/obdtest/obdtest.ino b/samples/obdtest/obdtest.ino
index a2b88b0..772ef40 100644
--- a/samples/obdtest/obdtest.ino
+++ b/samples/obdtest/obdtest.ino
@@ -39,7 +39,8 @@ uint16_t pid = 0x0111;
bool hasMPU6050 = false;
//create object to control an LCD.
-//LCD_OLED lcd;
+//LCD_SSD1306 lcd;
+//LCD_ZTOLED lcd;
LCD_PCD8544 lcd;
//LCD_1602 lcd;
//LCD_ILI9325D lcd;
@@ -303,6 +304,25 @@ void testMPU6050()
lcd.print(buf);
}
+void ShowECUCap()
+{
+ char buffer[24];
+ byte pidlist[] = {PID_RPM, PID_SPEED, PID_THROTTLE, PID_ENGINE_LOAD, PID_ABS_ENGINE_LOAD, PID_MAF_FLOW, PID_INTAKE_MAP, PID_FUEL_LEVEL, PID_FUEL_PRESSURE, PID_COOLANT_TEMP, PID_INTAKE_TEMP, PID_AMBIENT_TEMP, PID_TIMING_ADVANCE, PID_BAROMETRIC};
+ const char* namelist[] = {"RPM", "SPEED", "THROTTLE", "ENG.LOAD1", "ENG.LOAD2", "MAF", "MAP", "FUEL LV.", "FUEL PRE.", "COOLANT", "INTAKE","AMBIENT", "IGNITION", "BARO"};
+ byte i = 0;
+ lcd.clear();
+ lcd.setFont(FONT_SIZE_SMALL);
+ for (; i < sizeof(pidlist) / sizeof(pidlist[0]) / 2; i++) {
+ lcd.setCursor(0, i);
+ sprintf(buffer, "%s:%c", namelist[i], obd.IsValidPID(pidlist[i]) ? 'Y' : 'N');
+ lcd.print(buffer);
+ }
+ for (byte row = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++, row++) {
+ lcd.setCursor(64, row);
+ sprintf(buffer, "%s:%c", namelist[i], obd.IsValidPID(pidlist[i]) ? 'Y' : 'N');
+ lcd.print(buffer);
+ }
+}
void setup()
{
@@ -344,34 +364,6 @@ void setup()
delay(500);
} while(!obd.Init());
- char buffer[16];
- lcd.clear();
- sprintf(buffer, "RPM:%c", obd.IsValidPID(PID_RPM) ? 'Y' : 'N');
- lcd.print(buffer);
- lcd.setCursor(7, 0);
- sprintf(buffer, "SPD:%c", obd.IsValidPID(PID_SPEED) ? 'Y' : 'N');
- lcd.print(buffer);
-
- lcd.setCursor(0, 1);
- sprintf(buffer, "THR:%c", obd.IsValidPID(PID_THROTTLE) ? 'Y' : 'N');
- lcd.print(buffer);
- lcd.setCursor(7, 1);
- sprintf(buffer, "LOD:%c", obd.IsValidPID(PID_ENGINE_LOAD) ? 'Y' : 'N');
- lcd.print(buffer);
-
- lcd.setCursor(0, 2);
- sprintf(buffer, "MAF:%c", obd.IsValidPID(PID_MAF_FLOW) ? 'Y' : 'N');
- lcd.print(buffer);
- lcd.setCursor(7, 2);
- sprintf(buffer, "MAP:%c", obd.IsValidPID(PID_INTAKE_MAP) ? 'Y' : 'N');
- lcd.print(buffer);
-
- lcd.setCursor(0, 3);
- sprintf(buffer, "FUE:%c", obd.IsValidPID(PID_FUEL_LEVEL) ? 'Y' : 'N');
- lcd.print(buffer);
- lcd.setCursor(7, 3);
- sprintf(buffer, "PRE:%c", obd.IsValidPID(PID_FUEL_PRESSURE) ? 'Y' : 'N');
- lcd.print(buffer);
delay(3000);
lcd.clear();
//query();