summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2017-02-14 00:14:41 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2017-02-14 00:14:41 +1100
commitf5c7e17facba472b39b61f3846632e23e727b164 (patch)
treea583c7c084736357c1b66094209c32f7ce736389
parenteb076e45127ca5a59e6b158cc6c252de9a22a6a9 (diff)
download2021-arduino-obd-f5c7e17facba472b39b61f3846632e23e727b164.tar.gz
2021-arduino-obd-f5c7e17facba472b39b61f3846632e23e727b164.tar.bz2
2021-arduino-obd-f5c7e17facba472b39b61f3846632e23e727b164.zip
Test sketch for Arduino UNO with LCD
-rw-r--r--tester/tester.ino29
1 files changed, 23 insertions, 6 deletions
diff --git a/tester/tester.ino b/tester/tester.ino
index 20448a4..e2ec881 100644
--- a/tester/tester.ino
+++ b/tester/tester.ino
@@ -85,8 +85,7 @@ public:
while (!init());
showVIN();
-
- showECUCap();
+ showDTC();
delay(3000);
initScreen();
@@ -142,7 +141,7 @@ bool checkSD()
#endif
void testOut()
{
- static const char PROGMEM cmds[][6] = {"ATZ\r", "ATH0\r", "ATRV\r", "0100\r", "010C\r", "010D\r", "0902\r"};
+ static const char PROGMEM cmds[][6] = {"ATZ\r", "ATH1\r", "ATRV\r", "0100\r", "010C\r", "0902\r"};
char buf[128];
lcd.setColor(RGB16_WHITE);
@@ -167,15 +166,17 @@ bool checkSD()
while (*p == '\r') p++;
while (*p) {
lcd.write(*p);
- if (*p == '\r' && *(p + 1) != '\r')
+ if (*p == '\r')
lcd.write('\n');
p++;
}
+ lcd.println();
} else {
lcd.println("Timeout");
}
- delay(1000);
+ delay(500);
}
+ lcd.println();
}
void showVIN()
{
@@ -183,11 +184,26 @@ bool checkSD()
lcd.setFontSize(FONT_SIZE_MEDIUM);
if (getVIN(buf, sizeof(buf))) {
lcd.setColor(RGB16_WHITE);
- lcd.print("\nVIN:");
+ lcd.print("VIN:");
lcd.setColor(RGB16_YELLOW);
lcd.println(buf);
}
}
+ void showDTC()
+ {
+ uint16_t dtc[6];
+ int num = 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(' ');
+ }
+ }
+ }
void loop()
{
static byte index2 = 0;
@@ -212,6 +228,7 @@ bool checkSD()
if (isValidPID(pid) && readPID(pid, value)) {
dataTime = millis();
logData((uint16_t)pid | 0x100, value);
+ showData(pid, value);
lastSec = sec;
}
}