test fork

Dependencies:   SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary_9341 by Tick Tock

Revision:
164:46ed06263b0e
Parent:
163:3b6fab958773
Child:
165:4daa921730dd
--- a/main.cpp	Fri Nov 22 04:21:54 2013 +0000
+++ b/main.cpp	Thu Nov 28 03:23:30 2013 +0000
@@ -6,10 +6,10 @@
 // * Add in-device config editor
 // * Change pack volt color when CVLI fails
 // * 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
 
-// rev163
-// Fixed efficiency screen discontinuity when CC power changes
-// Added DTE & efficiency w/o CC to efficiency display
+// rev164
+// Turn off noCC DTE when CC is off
 
 #include "mbed.h"
 #include "CAN.h"
@@ -19,7 +19,7 @@
 #include "utility.h"
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
-char revStr[7] = "163"; // gg - revision string, max 6 characters
+char revStr[7] = "164"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -63,6 +63,8 @@
 bool syncDone = true;
 bool heaterOn = false;
 bool lHeaterOn = false;
+bool CCon = false;
+bool lCCon = false;
 
 FILE *hfile; // history file
 FIL efile; // external usb file
@@ -741,7 +743,17 @@
 
         if(tick){ // Executes once a second
             tick=false;
+            lCCon = CCon;
             CCkW = (lastMsg[indexLastMsg[0x510]].data[3]&0x7f)*0.125;
+            if(lastMsg[indexLastMsg[0x510]].data[3]&0x80){
+                 CCon=true; // On when button pushed
+            } else if(CCkW==0) {
+                CCon=false; // Off when power drops back to zero
+            }
+            if(!CCon && lCCon){
+                lastDMode[0]=99;//force refresh
+                lastDMode[1]=99;//force refresh
+            }
             if (miles_trip[0]>0.25) {
                 curEff = miles_trip[0]/kWh_trip[0];
             } else {
@@ -828,11 +840,10 @@
                 if (repeatPoll&&(wait5secs==0)) { // Poll on startup if autopoll enabled
                     logOnce=true;
                     reqMsgCnt=0;
-                    //sendTempReq();
                     msgReq.attach(&sendReq,0.015);
+                    lastDMode[0]=99;
+                    lastDMode[1]=99;
                 }
-                lastDMode[0]=99;
-                lastDMode[1]=99;
             }
 
             //remove health screen once moving