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
Throttle.cpp
00001 #include "Throttle.h" 00002 00003 const char Throttle::REQUEST_DATA[8] = {0x02, 0x01, 0x11, 0, 0, 0, 0, 0}; 00004 00005 Throttle::Throttle() 00006 : PidValue("Throttle", "%") 00007 { 00008 } 00009 00010 bool Throttle::decode(const uint8_t* data, uint16_t length) 00011 { 00012 if (length < 2) 00013 { 00014 return false; 00015 } 00016 00017 if ((data[1] != 0x11) || length != 3) 00018 { 00019 return false; 00020 } 00021 00022 m_value = data[2] * 100 / 255; // % 00023 return true; 00024 }
Generated on Tue Jul 12 2022 21:25:01 by 1.7.2