summaryrefslogtreecommitdiff
path: root/megalogger/megalogger.ino
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2015-10-16 17:02:28 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2015-10-16 17:02:28 +1100
commit650ec53481f58742546c7653e9f3eaa7f56b589d (patch)
treeb07d1cc9856d858fc623f5cd3f0f601c04d5da31 /megalogger/megalogger.ino
parent5de64679e196689429149c1fbdf2f79477e94aa2 (diff)
download2021-arduino-obd-650ec53481f58742546c7653e9f3eaa7f56b589d.tar.gz
2021-arduino-obd-650ec53481f58742546c7653e9f3eaa7f56b589d.tar.bz2
2021-arduino-obd-650ec53481f58742546c7653e9f3eaa7f56b589d.zip
Improve PID listing
Diffstat (limited to 'megalogger/megalogger.ino')
-rw-r--r--megalogger/megalogger.ino20
1 files changed, 12 insertions, 8 deletions
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino
index a9cb339..975335c 100644
--- a/megalogger/megalogger.ino
+++ b/megalogger/megalogger.ino
@@ -614,20 +614,22 @@ void showECUCap()
lcd.setFontSize(FONT_SIZE_SMALL);
lcd.setColor(RGB16_WHITE);
- for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) {
+ for (byte i = 0, n = 4; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) {
byte pid = pgm_read_byte(pidlist + i);
- lcd.setCursor(252, i + 4);
- lcd.write('0');
- lcd.print((int)pid | 0x100, HEX);
+ if (obd.isValidPID(pid)) {
+ lcd.setCursor(252, n++);
+ lcd.write('0');
+ lcd.print((int)pid | 0x100, HEX);
+ }
}
int values[sizeof(pidlist)];
bool scanned = false;
for (uint32_t t = millis(); millis() - t < GUI_PID_LIST_DURATION * 1000; ) {
- for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) {
+ for (byte i = 0, n = 4; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) {
byte pid = pgm_read_byte(pidlist + i);
- bool valid = obd.isValidPID(pid);
- if (valid) {
+ if (obd.isValidPID(pid)) {
int value;
+ lcd.setCursor(280 , n++);
if (obd.read(pid, value)) {
if (!scanned || value == values[i])
lcd.setColor(RGB16_CYAN);
@@ -635,10 +637,12 @@ void showECUCap()
lcd.setColor(RGB16_GREEN);
else
lcd.setColor(RGB16_RED);
- lcd.setCursor(280 , i + 4);
byte n = lcd.print(value);
for (; n < 4; n++) lcd.print(' ');
values[i] = value;
+ } else {
+ lcd.setColor(RGB16_YELLOW);
+ lcd.print("N/A");
}
}
}