Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary by Tick Tock

Revision:
141:cf13a632ddb5
Parent:
140:ab3e94eb0227
Child:
142:c1a11d6f181c
--- a/utility.cpp	Sun Aug 04 14:57:40 2013 +0000
+++ b/utility.cpp	Sun Aug 04 20:39:16 2013 +0000
@@ -1,5 +1,7 @@
 // utility.cpp
 #include "utility.h"
+unsigned long brkMonRate = 400000;
+unsigned short brkMonThr = 2000;
 
 void mbed_reset();
 
@@ -354,7 +356,7 @@
         }else if((mType==2)&&(canRXmsg.id==0x1ca)){ //Brake Pressure
             if(brakeMon){
                 if(canRXmsg.data[0]<0xff){
-                    if((canRXmsg.data[0]==0)||(imotorRPM==0)){
+                    if((canRXmsg.data[0]*imotorRPM)<brkMonThr){
                         chirpInt=0;
                     }else{
                         chirpInt=brkMonRate/imotorRPM;
@@ -535,6 +537,8 @@
     fprintf(cfile, "firmware %d\r\n", fwCount );            
     fprintf(cfile,"showHealth %d\r\n",(showHealth?1:0));
     fprintf(cfile,"brakeMon %d\r\n",(brakeMon?1:0));
+    fprintf(cfile,"brkMonRate %d\r\n", brkMonRate );            
+    fprintf(cfile,"brkMonThr %d\r\n", brkMonThr );            
     fclose(cfile);
 }
 
@@ -586,7 +590,7 @@
         if(ff>4) {
             int iMetric;
             fscanf(cfile, "metric %d\r\n", &iMetric );            
-            //metric = (bool)iMetric;
+            metric = (bool)iMetric; // This will get re-assigned based on dash selection
             fscanf(cfile, "firmware %d\r\n", &iMetric );
             fwCount = iMetric;
         }
@@ -599,6 +603,8 @@
             int iBrakeMon;
             fscanf(cfile, "brakeMon %d\r\n", &iBrakeMon );            
             brakeMon = (bool)iBrakeMon;
+            fscanf(cfile, "brkMonRate %d\r\n", &brkMonRate );        
+            fscanf(cfile, "brkMonThr %d\r\n", &brkMonThr );            
         }
         fclose(cfile);
         if(ff<7){//If not latest format, save as latest format
@@ -908,9 +914,8 @@
     static unsigned short counter=0;
     
     if(chirpInt>0){
-        counter++;
-        if(counter>chirpInt){
-            spkr.beep(500,0.01);
+        if(++counter>chirpInt){
+            spkr.beep(500,0.015);
             counter=0;
         }
     }
@@ -940,4 +945,7 @@
 brakeMon 0
 firmware 11
 showHealth 1
+brakeMon 1
+brkMonRate 400000
+brkMonThr 2000
 */
\ No newline at end of file