Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary by Tick Tock

Revision:
167:58d4edf403d4
Parent:
166:ec3951ba9701
Child:
168:9227024c4e3a
--- a/displayModes.cpp	Tue Dec 03 13:54:07 2013 +0000
+++ b/displayModes.cpp	Tue Dec 03 20:45:05 2013 +0000
@@ -37,7 +37,7 @@
             if (useable_kWh<0){
                 useable_kWh=0;
             }
-            if (useable_kWh<10){
+            if (useable_kWh<9.95){
                 tt.locate(166,4);
                 printf("  %3.1fkWh\n",useable_kWh);
             } else {
@@ -77,8 +77,10 @@
         }
         if(force||gids!=lgids||mpkWh[dtePeriod]!=lmpkWh){
             // Display DTE
-            // worse-case DTE
-            dte=convertDistance(minTripEff*useable_kWh); //LM - add metric conversion
+            // worst-case DTE
+            // Compute DTE based on worst saved trip efficiency (without climate control) and adding the impact 
+            // of the current climate control power relative to the last 10 minutes of driving
+            dte=convertDistance((minTripEff-mpkWh_noCC+mpkWh[dtePeriod])*useable_kWh); //LM - add metric conversion
             tt.foreground(Green);
             tt.locate(10,84);            
             if(dte>=9.5){
@@ -130,10 +132,13 @@
                     tt.locate(111,134);
                     printf("   %2.1f\n",dte);
                 }*/
+                lmaxTemp=0; //force battery termperature refresh (sometimes overlaps)
             }
             // best-case DTE
             tt.set_font((unsigned char*) Arial28x28);
-            dte=convertDistance(maxTripEff*useable_kWh); //LM - add metric conversion
+            // Compute DTE based on best saved trip efficiency (without climate control) and adding the impact 
+            // of the current climate control power relative to the last 10 minutes of driving
+            dte=convertDistance((maxTripEff-mpkWh_noCC+mpkWh[dtePeriod])*useable_kWh); //LM - add metric conversion
             tt.foreground(Orange);
             if(dte>=99.5){
                 tt.locate(255,84);