Small project to display some OBD values from the Toyota GT86/ Subaru BRZ/ Scion FRS on an OLED display.
Dependencies: Adafruit_GFX MODSERIAL mbed-rtos mbed
Diff: Throttle.cpp
- Revision:
- 5:0b229ba8ede5
- Child:
- 6:506b703a8acf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Throttle.cpp Sun Apr 27 19:13:35 2014 +0000 @@ -0,0 +1,23 @@ +#include "Throttle.h" + + +Throttle::Throttle() +: PidValue("Throttle", "%") +{ +} + +bool Throttle::decode(const uint8_t* data, uint16_t length) +{ + if (length < 2) + { + return false; + } + + if ((data[1] != 0x11) || length != 3) + { + return false; + } + + m_value = data[2] * 100 / 255; // % + return true; +}