Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Revision:
34:4751a8259b18
Parent:
33:a277743ebdeb
Child:
35:5acbd8a64a89
--- a/main.cpp	Tue Mar 19 04:43:43 2013 +0000
+++ b/main.cpp	Wed Mar 20 13:57:00 2013 +0000
@@ -80,7 +80,8 @@
 bool showCP = false;
 bool pollCP = false;
 bool repeatPoll = false;
-bool daylight = false;
+bool headlights = false;
+bool tick = false;
 
 int main() {
     int readPointer=0;
@@ -382,19 +383,23 @@
 
         display=display<1?display+1:0; // toggle display
         updateDisplay(display);
+
         if(pollCP){ // We do this inside main loop instead of ticker so CAN RX will not be blocked
             sendCPreq(); // send cellpair data request.
             wait_ms(16);
             sendTreq(); //send temperature request
             wait_ms(16);
+            showCP=true;
             pollCP=false;
-            showCP=true;
         }
-        if(daylight){
-            dled = 0.75;
-        }else{
-            dled = 0.1;
+        
+        if(tick){ // Executes once a second
+            if(!headlights){
+                dled = 0.75;
+            }else{
+                dled = 0.1;
+            }
+            tick=false;
         }
-
     } //while (true)
 }
\ No newline at end of file