Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary by
Revision 159:577e9d015693, committed 2013-11-08
- Comitter:
- TickTock
- Date:
- Fri Nov 08 16:07:53 2013 +0000
- Parent:
- 158:059abeb44ba1
- Child:
- 160:905fe45ed54b
- Commit message:
- // * Added heater activation warning message
Changed in this revision
--- a/displayModes.cpp Thu Oct 31 14:41:24 2013 +0000 +++ b/displayModes.cpp Fri Nov 08 16:07:53 2013 +0000 @@ -933,6 +933,12 @@ showButton(1,2,"Disable","RegMon",4,4); else showButton(1,2," Enable"," RegMon",4,4); + + if(heaterMon) + showButton(2,2,"Disable","HeatMon",4,4); + else + showButton(2,2," Enable","HeatMon",4,4); + } void config2(bool force, bool showButtons){ @@ -1318,30 +1324,6 @@ printf("%02d%02d%02d %02d%02d%03d\n",hour,minute,second,month,day,year);*/ //printf("%4.2fV %4.2fV \n",accV,accV2); - /*for (i=0; i<4; i++){ - msg = lastMsg[indexLastMsg[(uMsgId[i]>>4)]]; - uData[i] = msg.data[(uMsgId[i]&0x000f)]; - msg = lastMsg[indexLastMsg[(uMsgId[i+4]>>4)]]; - uData[i+4] = msg.data[(uMsgId[i+4]&0x000f)]; - tt.locate(10,90+i*30); - if(clearTest){ - oldData[i]=uData[i]; - oldData[i+4]=uData[i+4]; - tt.foreground(Yellow); - tt.background(Navy); - printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); - }else if((uData[i]!=oldData[i])||(uData[i+4]!=oldData[i+4])){ - tt.foreground(Yellow); - tt.background(Navy); - tt.foreground(Navy); - tt.background(Yellow); - printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); - }else if(force){ - tt.foreground(Yellow); - tt.background(Navy); - printf("%4x:%2x %4x:%2x\n",uMsgId[i],uData[i],uMsgId[i+4],uData[i+4]); - } - }*/ for (i=0; i<8; i++){ msg = lastMsg[indexLastMsg[(uMsgId[i]>>4)]]; uData[i] = msg.data[(uMsgId[i]&0x000f)]; @@ -1359,6 +1341,7 @@ tt.foreground(Navy); tt.background(Yellow); printf("%4x:%2x\n",uMsgId[i],uData[i]); + oldData[i]=uData[i]; }else if(force){ tt.foreground(Yellow); tt.background(Navy);
--- a/displayModes.h Thu Oct 31 14:41:24 2013 +0000 +++ b/displayModes.h Fri Nov 08 16:07:53 2013 +0000 @@ -60,7 +60,7 @@ extern signed short Imax, Imin; extern bool showHealth; extern float maxTripEff, minTripEff; -extern bool brakeMon, regenMon; +extern bool brakeMon, regenMon, heaterMon; extern float curEff; extern unsigned short uMsgId[8]; extern bool accOn;
--- 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;
--- 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;
--- a/utility.h Thu Oct 31 14:41:24 2013 +0000 +++ b/utility.h Fri Nov 08 16:07:53 2013 +0000 @@ -73,8 +73,7 @@ extern float miles_trip[0]; extern PwmOut dled; // for test extern PwmOut spkr; -extern bool brakeMon; -extern bool regenMon; +extern bool brakeMon, regenMon, heaterMon; extern Ticker geiger; extern unsigned short chirpInt; extern unsigned short uMsgId[8];