Dual CANbus monitor and instrumentation cluster supporting ILI9341 display controller
Dependencies: SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed
Fork of CANary by
Revision 135:89986950d501, committed 2013-07-26
- Comitter:
- TickTock
- Date:
- Fri Jul 26 04:35:31 2013 +0000
- Parent:
- 134:ad243e4f1a17
- Child:
- 136:41a204105511
- Commit message:
- Hide buttons on health screen on powerdown; Turn off screen even if logging if car off and user idle;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
utility.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jul 25 14:32:54 2013 +0000 +++ b/main.cpp Fri Jul 26 04:35:31 2013 +0000 @@ -7,14 +7,12 @@ // * Add coasting regen to regen/braking display // * Change semilog efficiency graph to linear with 10 minute values // * Add additional 79b bank readouts -// * Add ability to transfer settings config file to/from USB // * Subtract accessory power from efficiency history (add back in when displaying) +// * Add trip history display -// rev134 -// Added orange highlight if psi<32 -// Qualified max and min trip efficiency update with trips > 3 miles -// Keep mbed asleep during charging (EVcan only) unless logging active -// Added miles & kWh to trip log +// rev135 +// Hide buttons on health screen on powerdown +// Turn off screen even if logging if car off and user idle #include "mbed.h" #include "CAN.h" @@ -26,7 +24,7 @@ #include "displayModes.h" #include "TOUCH_TFTx2.h" -char revStr[7] = "134"; // gg - revision string, max 6 characters +char revStr[7] = "135"; // gg - revision string, max 6 characters FATFS USBdrive; LocalFileSystem local("local"); @@ -323,11 +321,9 @@ //__wfi(); // freeze CPU and wait for interrupt (from canbus or touch) Sleep(); } - if (logOpen){ // Re-attach EVcan + if (!logOpen){ // Re-attach EVcan can1.attach(&recieve1); } - lastDMode[0]=99; - lastDMode[1]=99; secsNoTouch=2; carCanIdle=secsNoCarCanMsg>canTimeout; evCanIdle=secsNoEvCanMsg>canTimeout; @@ -351,6 +347,7 @@ if (repeatPoll) { // re-enable autopolling if enabled autoPoll.attach(&autoPollISR,pollInt); } + wait5secs=3; // Refresh screen after 3 seconds } // if idle if(touched){ // call touchscreen procedure if touch interrupt detected @@ -702,7 +699,7 @@ saveDmode=dMode[0]; } dMode[0]=healthScreen; - secsNoTouch=0;// Keep display on a few seconds + secsNoTouch=2;// Keep display on a few seconds sMode=0; userIdle=false; } @@ -741,7 +738,8 @@ } } laccOn=accOn; - if(!accOn&&!logEn&&userIdle&&!playbackEn){ // Car off and logging disabled and no user activity + //if(!accOn&&!logEn&&userIdle&&!playbackEn){ // Car off and logging disabled and no user activity + if(!accOn&&userIdle&&!playbackEn){ // Car off and no user activity - turn off screen dled = 0; if (saveDmode<99){ dMode[0]=saveDmode; @@ -759,6 +757,8 @@ reqMsgCnt=0; msgReq.attach(&sendReq,0.015); } + lastDMode[0]=99; + lastDMode[1]=99; } //remove health screen once moving
--- a/utility.cpp Thu Jul 25 14:32:54 2013 +0000 +++ b/utility.cpp Fri Jul 26 04:35:31 2013 +0000 @@ -749,19 +749,19 @@ f_lseek(&bfile,0xffffffff); // go to end of file to append strftime(sTemp, 40, "%a %m/%d/%Y %X", &t); f_printf(&bfile,"%s,",sTemp); - sprintf(sTemp,"%3.1f,%d,%5.1f%%,%5.1f%%,%4.2f,%5.1f,%4.1f,%d,%d,%d,%d,%d,%4.1f,$4.1f",accV,gids,(float)SOC/10, (float)SOH_x100/100,(float)Ah_x10000/10000,(float)packV_x2/2,(float)packA_x2/2,max,min,avg,max-min,jv,miles_trip[0],kWh_trip[0]); + sprintf(sTemp,"%3.1f,%d,%5.1f%%,%5.1f%%,%4.2f,%5.1f,%4.1f,%d,%d,%d,%d,%d,%4.1f,%4.1f",accV,gids,(float)SOC/10, (float)SOH_x100/100,(float)Ah_x10000/10000,(float)packV_x2/2,(float)packA_x2/2,max,min,avg,max-min,jv,miles_trip[0],kWh_trip[0]); f_printf(&bfile,"%s,",sTemp); f_printf(&bfile,"%d,%d,%d,%d,",(battData[(BatDataBaseG4*7)+ 3]<<8)+battData[(BatDataBaseG4*7)+ 4],battData[(BatDataBaseG4*7)+ 5],(battData[(BatDataBaseG4*7)+ 6]<<8)+battData[(BatDataBaseG4*7)+ 7],battData[(BatDataBaseG4*7)+ 8]); f_printf(&bfile,"%d,%d,%d,%d", (battData[(BatDataBaseG4*7)+ 9]<<8)+battData[(BatDataBaseG4*7)+10],battData[(BatDataBaseG4*7)+11],(battData[(BatDataBaseG4*7)+12]<<8)+battData[(BatDataBaseG4*7)+13],battData[(BatDataBaseG4*7)+14]); - /*for(i=0; i<96; i++) { + for(i=0; i<96; i++) { bd=(battData[BatDataBaseG2*7+i*2+3]<<8)+battData[BatDataBaseG2*7+i*2+4]; f_printf(&bfile,",%d",bd); - }*/ + } // temporariliy dump everything - for(i=0; i<BatDataBufMax; i++) { + /*for(i=0; i<BatDataBufMax; i++) { sprintf(sTemp,",%02x",battData[i]); f_printf(&bfile,"%s",sTemp); - } + }*/ f_printf(&bfile,"\r\n"); f_close(&bfile);