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:
159:577e9d015693
Parent:
158:059abeb44ba1
Child:
160:905fe45ed54b
--- a/utility.cpp	Thu Oct 31 14:41:24 2013 +0000
+++ b/utility.cpp	Fri Nov 08 16:07:53 2013 +0000
@@ -313,7 +313,7 @@
             if(packA_x2>0x03ff){
                 packA_x2|=0xf800;//extend sign;
             }
-            packA_x2 -= 1; //Slight correction to value required (unique to my Leaf?)
+            packA_x2 -= 2; //Slight correction to value required (unique to my Leaf?)
             if (-packA_x2<Imin){
                 Imin=-packA_x2;
             } else if (-packA_x2>Imax){
@@ -547,7 +547,7 @@
     fprintf(cfile,"metric %d\r\n",(metric?1:0));
     fprintf(cfile, "firmware %d\r\n", fwCount );            
     fprintf(cfile,"showHealth %d\r\n",(showHealth?1:0));
-    fprintf(cfile,"brakeMon %d\r\n",(brakeMon?2:0)+(regenMon?1:0));
+    fprintf(cfile,"brakeMon %d\r\n",(heaterMon?4:0)+(brakeMon?2:0)+(regenMon?1:0));
     fprintf(cfile,"brkMonRate %d\r\n", brkMonRate );            
     fprintf(cfile,"brkMonThr %d\r\n", brkMonThr );            
     for(char i=0;i<8;i++){
@@ -652,6 +652,7 @@
             fscanf(cfile, "brakeMon %d\r\n", &readBool );
             brakeMon = (bool)(readBool&1);
             regenMon = (bool)(readBool&2);
+            heaterMon = (bool)(readBool&4);
             fscanf(cfile, "brkMonRate %d\r\n", &brkMonRate );        
             fscanf(cfile, "brkMonThr %d\r\n", &brkMonThr );            
         }
@@ -696,6 +697,7 @@
             showHealth=true;
             brakeMon=true;
             regenMon=true;
+            heaterMon=true;
             brkMonRate=400000;
             brkMonThr=4000;
             uMsgId[0]=0x5103;
@@ -1079,7 +1081,7 @@
     if (enableSound) {
         spkr.period(1.0/freq);
         spkr=0.5;
-        if(!headlights){
+        if(!headlights){ //restore LCD pwm output (Beep pwm interferes with display pwm)
                 dled = ledHi;
             } else {
                 dled = ledLo;