From 0fba6d59eb011c6254ba67e51462205eadad007a Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 13 Jun 2021 13:21:21 +0200 Subject: MyOBD : make debug runtime-controllable, lpo.ino: wait(20s) before readPID loop --- lpo/MyOBD.h | 9 +++++++-- lpo/lpo.ino | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lpo/MyOBD.h b/lpo/MyOBD.h index f2124c3..0f3004d 100644 --- a/lpo/MyOBD.h +++ b/lpo/MyOBD.h @@ -7,13 +7,18 @@ extern MyLCD lcd; class MyOBD : public COBDI2C { public: + int debug; + MyOBD() { + debug=0; + } void write(const char* s) { - lcd.print("<<<"); lcd.println(s); + if (this->debug) lcd.print("<<<"); lcd.println(s); COBDI2C::write(s); } byte receive(char* buffer, byte bufsize, int timeout) { byte res = COBDI2C::receive(buffer,bufsize, timeout); - lcd.print(">>>"); lcd.println(buffer); + if (this->debug) lcd.print(">>>"); lcd.println(buffer); + return res; } /* Fake OBD for testing int i; diff --git a/lpo/lpo.ino b/lpo/lpo.ino index b85de2b..5016aec 100644 --- a/lpo/lpo.ino +++ b/lpo/lpo.ino @@ -10,11 +10,15 @@ MyOBD obd; void setup() { lcd.begin(); + obd.debug=1; lcd.println("obd.begin()"); obd.begin(); reconnect(); showDTC(); - while(1); // Freeze exec here for now + + delay(20*1000); // Freeze for 20 seconds before displaying real-time PID values + obd.debug=0; + lcd.begin(); initScreen(); } @@ -38,9 +42,9 @@ void showDTC() { } else { for (c=0; c