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: PidDecoder.cpp
- Revision:
- 6:506b703a8acf
- Parent:
- 5:0b229ba8ede5
--- a/PidDecoder.cpp Sun Apr 27 19:13:35 2014 +0000 +++ b/PidDecoder.cpp Thu May 01 09:29:29 2014 +0000 @@ -6,6 +6,7 @@ #include "OilTemperature.h" #include "DebugPrint.h" +#include "display.h" static VehicleSpeed speed; static EngineRpm rpm; @@ -14,7 +15,10 @@ OilTemperature oilTemperature; static PidValue* pids[] = { &speed, &rpm, &temp, &throttle, &oilTemperature -}; +}; + +extern Display display; +char buf[128]; void PidDecoder::decode(const uint8_t* data, uint16_t length) { @@ -24,6 +28,9 @@ { pc.printf("New Value for %s: ", pids[i]->getName()); pids[i]->print(); + snprintf(buf, sizeof(buf), "%s: %d %s", pids[i]->getName(), pids[i]->getValue(), pids[i]->getUnit()); + display.sendTo(buf); + display.display(); } } }