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