diff options
Diffstat (limited to 'obdlogger')
-rw-r--r-- | obdlogger/OBD.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/obdlogger/OBD.cpp b/obdlogger/OBD.cpp index 609e5dd..55f31e6 100644 --- a/obdlogger/OBD.cpp +++ b/obdlogger/OBD.cpp @@ -69,20 +69,20 @@ void COBD::Query(unsigned char pid) bool COBD::ReadSensor(byte pid, int& result, bool passive) { - // send a query command - Query(pid); - // wait for reponse - bool hasData; - unsigned long tick = millis(); - do { - DataIdleLoop(); - } while (!(hasData = available()) && millis() - tick < OBD_TIMEOUT_SHORT); - if (!hasData) { - errors++; - return false; - } - // receive and parse the response - return GetResponseParsed(pid, result); + // send a query command + Query(pid); + // wait for reponse + bool hasData; + unsigned long tick = millis(); + do { + DataIdleLoop(); + } while (!(hasData = available()) && millis() - tick < OBD_TIMEOUT_SHORT); + if (!hasData) { + errors++; + return false; + } + // receive and parse the response + return GetResponseParsed(pid, result); } bool COBD::available() |