Tick Tock / Mbed 2 deprecated CANary_9341_test

Dependencies:   SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary_9341 by Tick Tock

Files at this revision

API Documentation at this revision

Comitter:
TickTock
Date:
Tue Dec 03 13:54:07 2013 +0000
Parent:
165:4daa921730dd
Child:
167:58d4edf403d4
Commit message:
// Re-formatted main and dte displays; // Fixed flicker on CC DTE;

Changed in this revision

displayModes.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/displayModes.cpp	Tue Dec 03 02:56:50 2013 +0000
+++ b/displayModes.cpp	Tue Dec 03 13:54:07 2013 +0000
@@ -30,7 +30,7 @@
     if(force) tt.cls();
     if(skin==ttSkin){
         if(force||gids!=lgids){
-            tt.locate(16,4);
+            tt.locate(10,4);
             tt.foreground(White);
             printf("%dgids \n",gids);
             useable_kWh = (float)(gids-5)*0.075;
@@ -46,9 +46,9 @@
             }
         }
         if(force||SOC_x10!=lSOC){
-            tt.locate(16,34);//216,10
+            tt.locate(10,34);//216,10
             tt.foreground(LightGrey);
-            printf("%4.1f%s\n",(float)SOC_x10/10,"%");
+            printf("%2.1f%s\n",(float)SOC_x10/10,"%");
             lSOC=SOC_x10;
         }
         total_kW=kW[0]+CCkW;
@@ -80,7 +80,7 @@
             // worse-case DTE
             dte=convertDistance(minTripEff*useable_kWh); //LM - add metric conversion
             tt.foreground(Green);
-            tt.locate(16,84);            
+            tt.locate(10,84);            
             if(dte>=9.5){
                 printf("%2.0f \n",dte);
             }else{
@@ -157,7 +157,7 @@
         }
         if(force||aTemp!=laTemp){
             tt.foreground(Cyan);
-            tt.locate(16,146);
+            tt.locate(10,146);
             printf("%2.0f%s\n",convertF(aTemp),temperatureUnit());
             laTemp=aTemp;
         }
@@ -172,7 +172,7 @@
             lmaxTemp=maxTemp;
         }
         if(force||accV!=laccV){
-            tt.locate(16,176);
+            tt.locate(10,176);
             tt.foreground(Yellow);
             printf("%3.1fV  \n",accV);
             laccV=accV;
--- a/main.cpp	Tue Dec 03 02:56:50 2013 +0000
+++ b/main.cpp	Tue Dec 03 13:54:07 2013 +0000
@@ -1,6 +1,7 @@
 // main.cpp
 //
 //To Do:
+// * Fix USB hot plug (must reset every time USB plugged)
 // * Add 50% charge option
 // * Add linear efficiency graph with 10 minute values
 // * Add in-device config editor
@@ -8,8 +9,9 @@
 // * Add tire pressure cal (40psi for me = FR 38, RR 38.2, FL 37.8, RL 38 - maybe 2psi error on my tire gauge?)
 // * Add on screen messages for heater on, etc, and use refresh feature above to clear in x seconds
 
-// rev165
+// rev166
 // Re-formatted main and dte displays
+// Fixed flicker on CC DTE
 
 #include "mbed.h"
 #include "CAN.h"
@@ -19,7 +21,7 @@
 #include "utility.h"
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
-char revStr[7] = "165"; // gg - revision string, max 6 characters
+char revStr[7] = "166"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -217,6 +219,7 @@
             if(!feof(hfile)){
                 fscanf(hfile,"%f %f\r\n",&mph[i],&kW[i]);
                 mpkWh[i]=mph[i]/kW[i];
+                if(i==dtePeriod) mpkWh_noCC=mpkWh[i];
             }
         }
         if(!feof(hfile)){