diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2013-07-28 11:23:38 +0800 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2013-07-28 11:23:38 +0800 |
commit | 81cf413d99aec5eeffa88e32f1f8fd34c724723f (patch) | |
tree | c92c84b3575d0ebaeb7a45f8758d3d8567383395 /libraries/OBD | |
parent | 1e56a244b3e0bdb434ac507a49b359767886be81 (diff) | |
download | 2021-arduino-obd-81cf413d99aec5eeffa88e32f1f8fd34c724723f.tar.gz 2021-arduino-obd-81cf413d99aec5eeffa88e32f1f8fd34c724723f.tar.bz2 2021-arduino-obd-81cf413d99aec5eeffa88e32f1f8fd34c724723f.zip |
minor updates for OBD library
Diffstat (limited to 'libraries/OBD')
-rw-r--r-- | libraries/OBD/OBD.cpp | 3 | ||||
-rw-r--r-- | libraries/OBD/OBD.h | 1 | ||||
-rw-r--r-- | libraries/OBD/examples/rpm_led/rpm_led.ino | 2 |
3 files changed, 4 insertions, 2 deletions
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()); |