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

Committer:
chrta
Date:
Thu May 01 09:29:29 2014 +0000
Revision:
6:506b703a8acf
Parent:
5:0b229ba8ede5
Changes for display.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrta 5:0b229ba8ede5 1 #include "Throttle.h"
chrta 5:0b229ba8ede5 2
chrta 6:506b703a8acf 3 const char Throttle::REQUEST_DATA[8] = {0x02, 0x01, 0x11, 0, 0, 0, 0, 0};
chrta 5:0b229ba8ede5 4
chrta 5:0b229ba8ede5 5 Throttle::Throttle()
chrta 5:0b229ba8ede5 6 : PidValue("Throttle", "%")
chrta 5:0b229ba8ede5 7 {
chrta 5:0b229ba8ede5 8 }
chrta 5:0b229ba8ede5 9
chrta 5:0b229ba8ede5 10 bool Throttle::decode(const uint8_t* data, uint16_t length)
chrta 5:0b229ba8ede5 11 {
chrta 5:0b229ba8ede5 12 if (length < 2)
chrta 5:0b229ba8ede5 13 {
chrta 5:0b229ba8ede5 14 return false;
chrta 5:0b229ba8ede5 15 }
chrta 5:0b229ba8ede5 16
chrta 5:0b229ba8ede5 17 if ((data[1] != 0x11) || length != 3)
chrta 5:0b229ba8ede5 18 {
chrta 5:0b229ba8ede5 19 return false;
chrta 5:0b229ba8ede5 20 }
chrta 5:0b229ba8ede5 21
chrta 5:0b229ba8ede5 22 m_value = data[2] * 100 / 255; // %
chrta 5:0b229ba8ede5 23 return true;
chrta 5:0b229ba8ede5 24 }