summaryrefslogtreecommitdiff
path: root/libraries/OBD
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2016-04-02 10:02:21 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2016-04-02 10:02:21 +1100
commitbcc1dc50292f65fc958f56df0c0558e301175189 (patch)
treef60b833d3023769cd3196676b4c273a8b801a116 /libraries/OBD
parentd484853a7af5a6fbef8aaff198aa9c900c4f69c7 (diff)
download2021-arduino-obd-bcc1dc50292f65fc958f56df0c0558e301175189.tar.gz
2021-arduino-obd-bcc1dc50292f65fc958f56df0c0558e301175189.tar.bz2
2021-arduino-obd-bcc1dc50292f65fc958f56df0c0558e301175189.zip
Added definition for Fuel–Air commanded equivalence ratio
Diffstat (limited to 'libraries/OBD')
-rw-r--r--libraries/OBD/OBD.cpp9
-rw-r--r--libraries/OBD/OBD.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp
index 6ede386..2499500 100644
--- a/libraries/OBD/OBD.cpp
+++ b/libraries/OBD/OBD.cpp
@@ -117,10 +117,10 @@ int COBD::normalizeData(byte pid, char* data)
int result;
switch (pid) {
case PID_RPM:
- case PID_EVAP_SYS_VAPOR_PRESSURE:
+ case PID_EVAP_SYS_VAPOR_PRESSURE: // kPa
result = getLargeValue(data) >> 2;
break;
- case PID_FUEL_PRESSURE:
+ case PID_FUEL_PRESSURE: // kPa
result = getSmallValue(data) * 3;
break;
case PID_COOLANT_TEMP:
@@ -146,7 +146,7 @@ int COBD::normalizeData(byte pid, char* data)
case PID_HYBRID_BATTERY_PERCENTAGE:
result = getPercentageValue(data);
break;
- case PID_MAF_FLOW:
+ case PID_MAF_FLOW: // grams/sec
result = getLargeValue(data) / 100;
break;
case PID_TIMING_ADVANCE:
@@ -187,6 +187,9 @@ int COBD::normalizeData(byte pid, char* data)
case PID_CATALYST_TEMP_B2S2:
result = getLargeValue(data) / 10 - 40;
break;
+ case PID_AIR_FUEL_EQUIV_RATIO: // 0~200
+ result = (long)getLargeValue(data) * 200 / 65536;
+ break;
default:
result = getSmallValue(data);
}
diff --git a/libraries/OBD/OBD.h b/libraries/OBD/OBD.h
index c42b450..ba10631 100644
--- a/libraries/OBD/OBD.h
+++ b/libraries/OBD/OBD.h
@@ -55,6 +55,7 @@
#define PID_CATALYST_TEMP_B2S2 0x3F
#define PID_CONTROL_MODULE_VOLTAGE 0x42
#define PID_ABSOLUTE_ENGINE_LOAD 0x43
+#define PID_AIR_FUEL_EQUIV_RATIO 0x44
#define PID_RELATIVE_THROTTLE_POS 0x45
#define PID_AMBIENT_TEMP 0x46
#define PID_ABSOLUTE_THROTTLE_POS_B 0x47