diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2017-01-24 22:21:28 +1100 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2017-01-24 22:21:28 +1100 |
commit | 7e6c599d4149f069c1cadc086ad87bafb75d4cd3 (patch) | |
tree | 8641005ca84aa5dcd6d319964e3096d5b99f7d7e /megaloggerHD | |
parent | 848e69776125c5816465ad1a80d5363c146da0e8 (diff) | |
download | 2021-arduino-obd-7e6c599d4149f069c1cadc086ad87bafb75d4cd3.tar.gz 2021-arduino-obd-7e6c599d4149f069c1cadc086ad87bafb75d4cd3.tar.bz2 2021-arduino-obd-7e6c599d4149f069c1cadc086ad87bafb75d4cd3.zip |
Added DTC reading
Diffstat (limited to 'megaloggerHD')
-rw-r--r-- | megaloggerHD/megaloggerHD.ino | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/megaloggerHD/megaloggerHD.ino b/megaloggerHD/megaloggerHD.ino index 7d32709..efc5f71 100644 --- a/megaloggerHD/megaloggerHD.ino +++ b/megaloggerHD/megaloggerHD.ino @@ -574,15 +574,11 @@ void reconnect() state &= ~(STATE_OBD_READY | STATE_GUI_ON); //digitalWrite(SD_CS_PIN, LOW); for (;;) { - if (!obd.init()) - continue; - - int value; - if (obd.readPID(PID_RPM, value)) + if (obd.init()) break; obd.sleep(); - Narcoleptic.delay(4000); + Narcoleptic.delay(10000); } // re-initialize state |= STATE_OBD_READY; @@ -731,8 +727,23 @@ void setup() lcd.print("VIN:"); lcd.setColor(RGB16_YELLOW); lcd.println(buf); + lcd.println(); } + uint16_t dtc[6]; + int num = obd.readDTC(dtc, sizeof(dtc) / sizeof(dtc[0])); + lcd.setColor(RGB16_WHITE); + lcd.print(num); + lcd.println(" DTC found"); + if (num > 0) { + lcd.setColor(RGB16_YELLOW); + for (byte i = 0; i < num; i++) { + lcd.print(dtc[i], HEX); + lcd.print(' '); + } + } + lcd.println(); + showECUCap(); lcd.setCursor(0, 28); lcd.setColor(RGB16_YELLOW); |