From 81cf413d99aec5eeffa88e32f1f8fd34c724723f Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Sun, 28 Jul 2013 11:23:38 +0800 Subject: minor updates for OBD library --- libraries/OBD/OBD.cpp | 3 ++- libraries/OBD/OBD.h | 1 + libraries/OBD/examples/rpm_led/rpm_led.ino | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'libraries/OBD') diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp index 38fbf01..15aacd7 100644 --- a/libraries/OBD/OBD.cpp +++ b/libraries/OBD/OBD.cpp @@ -11,7 +11,7 @@ #define MAX_CMD_LEN 6 -const char PROGMEM s_initcmd[][MAX_CMD_LEN] = {"ATZ\r","ATE0\r","ATL1\r","ATI\r"}; +const char PROGMEM s_initcmd[][MAX_CMD_LEN] = {"\rATZ\r","ATE0\r","ATL1\r","ATI\r"}; const char PROGMEM s_searching[] = "SEARCHING"; const char PROGMEM s_cmd_fmt[] = "%02X%02X 1\r"; const char PROGMEM s_cmd_sleep[] = "atlp\r"; @@ -77,6 +77,7 @@ bool COBD::readSensor(byte pid, int& result, bool passive) dataIdleLoop(); } while (!(hasData = available()) && millis() - tick < OBD_TIMEOUT_SHORT); if (!hasData) { + write('\r'); errors++; return false; } diff --git a/libraries/OBD/OBD.h b/libraries/OBD/OBD.h index 28cc19d..cd67192 100644 --- a/libraries/OBD/OBD.h +++ b/libraries/OBD/OBD.h @@ -81,4 +81,5 @@ protected: virtual void initIdleLoop() {} virtual void dataIdleLoop() {} byte pidmap[4 * 4]; + byte vin[17]; }; diff --git a/libraries/OBD/examples/rpm_led/rpm_led.ino b/libraries/OBD/examples/rpm_led/rpm_led.ino index 9ebf34f..669d690 100644 --- a/libraries/OBD/examples/rpm_led/rpm_led.ino +++ b/libraries/OBD/examples/rpm_led/rpm_led.ino @@ -14,7 +14,7 @@ void setup() { // we'll use the debug LED as output pinMode(13, OUTPUT); - // start serial communication at the adapter defined baudrate + // start communication with OBD-II UART adapter obd.begin(); // initiate OBD-II connection until success while (!obd.init()); -- cgit v1.2.3