diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-06-05 10:49:20 +1000 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-06-05 10:49:20 +1000 |
commit | ba60264cd16d3ec475881c73e85dc7d76ad8b08d (patch) | |
tree | ff4113d1d595803a250be20142cb91e62e3ccc68 /libraries/OBD/OBD.cpp | |
parent | cffa5cfeaac6624141dcc4cb015a05b64672ba15 (diff) | |
parent | cdbb8b35621239c14bd7b1043614ad158b233c32 (diff) | |
download | 2021-arduino-obd-ba60264cd16d3ec475881c73e85dc7d76ad8b08d.tar.gz 2021-arduino-obd-ba60264cd16d3ec475881c73e85dc7d76ad8b08d.tar.bz2 2021-arduino-obd-ba60264cd16d3ec475881c73e85dc7d76ad8b08d.zip |
Merge branch 'master' of https://github.com/stanleyhuangyc/ArduinoOBD
Diffstat (limited to 'libraries/OBD/OBD.cpp')
-rw-r--r-- | libraries/OBD/OBD.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp index 9b503c9..dd770d9 100644 --- a/libraries/OBD/OBD.cpp +++ b/libraries/OBD/OBD.cpp @@ -1,7 +1,7 @@ /*************************************************************************
* Arduino Library for OBD-II UART/I2C Adapter
* Distributed under GPL v2.0
-* Visit http://arduinodev.com for more information
+* Visit http://freematics.com for more information
* (C)2012-2014 Stanley Huang <stanleyhuangyc@gmail.com>
*************************************************************************/
@@ -482,7 +482,7 @@ uint16_t COBDI2C::getData(byte pid, int& result) case PID_ABSOLUTE_ENGINE_LOAD:
case PID_ETHANOL_PERCENTAGE:
case PID_HYBRID_BATTERY_PERCENTAGE:
- result = pi->value * 100 / 255; // %
+ result = (uint16_t)(pi->value * 100 + 50) / 255;
break;
case PID_MAF_FLOW:
result = pi->value / 100;
@@ -490,14 +490,14 @@ uint16_t COBDI2C::getData(byte pid, int& result) case PID_TIMING_ADVANCE:
result = (int)pi->value / 2 - 64;
break;
- case PID_CONTROL_MODULE_VOLTAGE: // V
- result = pi->value / 1000;
+ case PID_CONTROL_MODULE_VOLTAGE: // mV
+ result = pi->value;
break;
case PID_ENGINE_FUEL_RATE: // L/h
result = pi->value / 20;
break;
case PID_ENGINE_TORQUE_PERCENTAGE: // %
- result = (int)pi->value - 125;
+ result = (uint16_t)pi->value - 125;
break;
default:
result = pi->value;
|