From bcc1dc50292f65fc958f56df0c0558e301175189 Mon Sep 17 00:00:00 2001
From: Stanley Huang <stanleyhuangyc@gmail.com>
Date: Sat, 2 Apr 2016 10:02:21 +1100
Subject: Added definition for Fuel–Air commanded equivalence ratio
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 libraries/OBD/OBD.cpp | 9 ++++++---
 libraries/OBD/OBD.h   | 1 +
 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
-- 
cgit v1.2.3