summaryrefslogtreecommitdiff
path: root/libraries/OBD/OBD.cpp
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2014-09-07 00:07:23 +1000
committerStanley Huang <stanleyhuangyc@gmail.com>2014-09-07 00:07:23 +1000
commit78698f65a918bfdb90dc3a19a85c84c9833125ba (patch)
treeeb15d2e97797845143dc309816fd15d51ece13e0 /libraries/OBD/OBD.cpp
parenta8fb423e8a84713ef7d4f84dcc04104e7e0c9f5b (diff)
download2021-arduino-obd-78698f65a918bfdb90dc3a19a85c84c9833125ba.tar.gz
2021-arduino-obd-78698f65a918bfdb90dc3a19a85c84c9833125ba.tar.bz2
2021-arduino-obd-78698f65a918bfdb90dc3a19a85c84c9833125ba.zip
bug fix in getVoltage()
Diffstat (limited to 'libraries/OBD/OBD.cpp')
-rw-r--r--libraries/OBD/OBD.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp
index f1b0c0c..a568d7a 100644
--- a/libraries/OBD/OBD.cpp
+++ b/libraries/OBD/OBD.cpp
@@ -257,6 +257,10 @@ unsigned int COBD::getVoltage()
int v2 = 0;
char *p = strchr(buf, '.');
if (p) v2 = atoi(p + 1);
+ if (v2 < 10)
+ v2 *= 100;
+ else if (v2 <100)
+ v2 *= 10;
return (unsigned int)v1 * 1000 + v2;
}
}