test fork

Dependencies:   SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary_9341 by Tick Tock

Revision:
159:577e9d015693
Parent:
158:059abeb44ba1
Child:
160:905fe45ed54b
--- a/main.cpp	Thu Oct 31 14:41:24 2013 +0000
+++ b/main.cpp	Fri Nov 08 16:07:53 2013 +0000
@@ -7,12 +7,9 @@
 // * 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 heater activation warning message
 
-// rev158
-// Fixed bug in date/time sync to sync on all days of the month
-// Added auto time sync enable/disable button to cofig2 screen
-// Highlighted row if data changed in testScreen
+// rev159
+// * Added heater activation warning message
 
 #include "mbed.h"
 #include "CAN.h"
@@ -22,7 +19,7 @@
 #include "utility.h"
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
-char revStr[7] = "158"; // gg - revision string, max 6 characters
+char revStr[7] = "159"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -61,8 +58,11 @@
 unsigned char tNavRow = 3; // gg - 4x4 touch
 bool brakeMon = false;  // disable until desired value read from config
 bool regenMon = false;
+bool heaterMon = false;
 bool autoSync = false;  // auto clock sync on powerup
 bool syncDone = true;
+bool heaterOn = false;
+bool lHeaterOn = false;
 
 FILE *hfile; // history file
 FIL efile; // external usb file
@@ -653,6 +653,8 @@
                              case 22: // right-middle col, bottom row (not nav)
                                 if (dMode[whichTouched]==indexScreen) { // gg - index
                                     dMode[whichTouched] = logScreen ;    
+                                } else if (dMode[whichTouched]==configScreen) {
+                                    heaterMon = !heaterMon;
                                 } else if (dMode[whichTouched]==config2Screen) {
                                     showHealth = !showHealth;
                                 } else {
@@ -742,6 +744,11 @@
                 curEff = 0;
             }
             headlights = (lastMsg[indexLastMsg[0x358]].data[1]&0x80)?true:false;  // headlight/turn signal indicator
+            lHeaterOn = heaterOn;
+            heaterOn =((lastMsg[indexLastMsg[0x54f]].data[5]&0x3f)>0)?true:false;
+            if(heaterMon && heaterOn && !lHeaterOn){ //Heat on alarm
+                beep(1600,0.5);
+            }
             if(accOn&&indexLastMsg[0x355]>0){
                 miles_kmbar = (lastMsg[indexLastMsg[0x355]].data[4]&0x20)?true:false;  // indicates selected distance units
                 metric = !miles_kmbar;