Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary by Tick Tock

Branch:
Metric
Revision:
113:f388b4505463
Parent:
111:d1559bb25c43
Child:
118:02010b18efdc
--- a/displayModes.cpp	Mon Jul 01 01:58:36 2013 +0000
+++ b/displayModes.cpp	Mon Jul 01 02:54:46 2013 +0000
@@ -72,16 +72,16 @@
 }
 
 void tripDisplay (bool force, bool showButtons){
-    static float lmiles=0;
+    static float lkWh=0;
     tt.background(White);
     if(force){
         tt.cls();
     }
-    if(force||(int)lmiles!=(int)miles_trip[0]){ //only update if changed
+    if(force||(int)(lkWh*100)!=(int)(kWh_trip[0]*100)){ //only update if changed
         tt.foreground(Navy);
         tt.set_font((unsigned char*) Arial28x28);
         tt.locate(6,210);
-        printf("kWh :  %s : Eff\n",distanceUnit());
+        printf("kWh : %s : Eff\n",distanceUnit());
         for(int i=0; i<3; i++){
             tt.locate(6,20+i*60);
             printf("%3.2f : %3.1f : %2.1f\n",kWh_trip[i],convertDistance(miles_trip[i]),convertDistance(miles_trip[i])/kWh_trip[i]);
@@ -91,6 +91,7 @@
         tt.foreground(Yellow);
         showButton(3,1," Reset","   A",4,4);
         showButton(3,2," Reset","   B",4,4);
+        lkWh=kWh_trip[0];
     }
 }
 
@@ -312,8 +313,8 @@
     msg = lastMsg[indexLastMsg[0x1cb]]; //Get Target and Regen
     regenBraking = (msg.data[0]<<3)+(msg.data[1]>>5);
     targetBraking = (msg.data[2]<<3)+(msg.data[3]>>5);
-    msg = lastMsg[indexLastMsg[0x176]]; //Get Drive Mode
-    if (msg.data[3]==0xAA) { // In Park or Neutral
+    msg = lastMsg[indexLastMsg[0x421]]; //Get Drive Mode
+    if (msg.data[0]==0x18) { // In Neutral
         regenBraking = 0;  // No regen when in Neutral
     }
 
@@ -1026,8 +1027,8 @@
     msg = lastMsg[indexLastMsg[0x1cb]]; //Get Target and Regen
     regenBraking = (msg.data[0]<<3)+(msg.data[1]>>5);
     targetBraking = (msg.data[2]<<3)+(msg.data[3]>>5);
-    msg = lastMsg[indexLastMsg[0x176]]; //Get Drive Mode
-    if (msg.data[3]==0xAA) { // In Park or Neutral
+    msg = lastMsg[indexLastMsg[0x421]]; //Get Drive Mode
+    if (msg.data[0]==0x18) { // In Neutral
         regenBraking = 0;  // No regen when in Neutral
     }
 
@@ -1312,8 +1313,8 @@
     msg = lastMsg[indexLastMsg[0x1cb]]; //Get Target and Regen
     regenBraking = (msg.data[0]<<3)+(msg.data[1]>>5);
     targetBraking = (msg.data[2]<<3)+(msg.data[3]>>5);
-    msg = lastMsg[indexLastMsg[0x176]]; //Get Drive Mode
-    if (msg.data[3]==0xAA) { // In Park or Neutral
+    msg = lastMsg[indexLastMsg[0x421]]; //Get Drive Mode
+    if (msg.data[0]==0x18) { // In Neutral
         regenBraking = 0;  // No regen when in Neutral
     }
     msg = lastMsg[indexLastMsg[0x176]]; //Get rpms - not sure what this is but scales to mph with .0725