Dual CANbus monitor and instrumentation cluster supporting ILI9341 display controller

Dependencies:   SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed

Fork of CANary by Tick Tock

Revision:
95:248b3c25a7df
Parent:
94:c3a14b3975d6
Child:
96:a6c6a6fd1d28
--- a/main.cpp	Fri May 03 11:25:03 2013 +0000
+++ b/main.cpp	Fri May 03 12:18:10 2013 +0000
@@ -8,6 +8,7 @@
 // * Add 50% charge option
 // * Tire Pressure Sensor display
 // * Fix bug in playback while connected to canbus (hangs)
+// * Add temperature to Main screen
 
 #include "mbed.h"
 #include "CAN.h"
@@ -50,7 +51,7 @@
 // gg - revStr is used in 2 places
 // gg - and is easy to edit here
 // gg - added ZeroSecTick and revStr
-char revStr[7] = "94";
+char revStr[7] = "95";
 
 bool debugMode = false;
 bool logEn = false, logOpen = false; 
@@ -124,7 +125,7 @@
 bool updateDTE = false;
 unsigned short pointerSep;
 unsigned char reqMsgCnt = 99;
-
+unsigned char battTemp_x4 = 99;
 int main() {
     char sTemp[40];
     unsigned long secs;
@@ -301,6 +302,9 @@
             }
         } // if logOpen
         if (canIdle&&userIdle&&!playbackEn) { // canbus idle --> sleep to save power
+            if (repeatPoll) { // stop autopolling if enabled
+                autoPoll.detach();
+            }
             if (logOpen){
                 fclose(file);
             } // if (logOpen)*/
@@ -325,7 +329,6 @@
             }
             secsNoTouch=2;
             canIdle=secsNoMsg>canTimeout;
-            //userIdle=!touched;
             dled=0.8; // turn on display LED
             seconds = time(NULL);
             t = *localtime(&seconds) ;
@@ -339,6 +342,9 @@
                 logEvent("WakingUp"); // gg - use messeges
                 logTS(); // Date-Time at wakeup
             }
+            if (repeatPoll) { // re-enable autopolling if enabled
+                autoPoll.attach(&autoPollISR,pollInt);
+            }
         } // if idle
         
         if(touched){ // call touchscreen procedure if touch interrupt detected