summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2015-10-20 22:29:56 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2015-10-20 22:29:56 +1100
commitf1ee6f1d3f900ec094f7009a539b0b28ef643bb1 (patch)
treecede789d0317bad2dd8f96ccbd800fa6faac7975
parent650ec53481f58742546c7653e9f3eaa7f56b589d (diff)
download2021-arduino-obd-f1ee6f1d3f900ec094f7009a539b0b28ef643bb1.tar.gz
2021-arduino-obd-f1ee6f1d3f900ec094f7009a539b0b28ef643bb1.tar.bz2
2021-arduino-obd-f1ee6f1d3f900ec094f7009a539b0b28ef643bb1.zip
Workaround for initialization timeout issue
-rw-r--r--libraries/OBD/OBD.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp
index 2689498..c571be9 100644
--- a/libraries/OBD/OBD.cpp
+++ b/libraries/OBD/OBD.cpp
@@ -348,8 +348,13 @@ bool COBD::init(OBD_PROTOCOLS protocol)
#endif
write(initcmd[i]);
if (receive(buffer, OBD_TIMEOUT_LONG) == 0) {
- m_state = OBD_DISCONNECTED;
- return false;
+ if (i == 0) {
+ // workaround for longer initialization time
+ delay(2000);
+ } else {
+ m_state = OBD_DISCONNECTED;
+ return false;
+ }
}
delay(50);
}