test fork
Dependencies: SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary_9341 by
Diff: main.cpp
- Revision:
- 175:0357b4159b40
- Parent:
- 174:cd27e80f197d
- Child:
- 176:9c19f9856c76
--- a/main.cpp Sun Jan 05 05:02:41 2014 +0000 +++ b/main.cpp Fri Feb 07 01:59:53 2014 +0000 @@ -11,8 +11,10 @@ // * Add climate control impact to main max/min dte and new trip display // * Be more efficient with write buffer (use msgLen instead of always storing 8 bytes) -// rev174 -// Calibrated brake monitor. brkMonRate 378947 --> 1 chirp per 4Wh +// rev175 +// Added to the temperature lookup table +// Fixed div0 boundary condition bug in CP histogram +// Splash trip meter on second screen when turned off if showHealth is enabled #include "mbed.h" #include "CAN.h" @@ -23,7 +25,7 @@ #include "displayModes.h" #include "TOUCH_TFTx2.h" -char revStr[7] = "174"; +char revStr[7] = "175"; unsigned long maxTarget = 1000; FATFS USBdrive; LocalFileSystem local("local"); @@ -168,7 +170,7 @@ bool shunt[96]={0}; bool charging=false; bool showHealth=false; -unsigned char saveDmode=99; +unsigned char saveDmode[2] = {99, 99}; bool moving=false; unsigned short chirpInt; unsigned short uMsgId[8] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; // messages to display on debug screen msgId:byte @@ -823,10 +825,12 @@ if (laccOn&&!accOn){ // Car turned off lHeaterOn=false; if (showHealth&&!playbackOpen){ - if (saveDmode==99){ - saveDmode=dMode[0]; + if (saveDmode[0]==99){ + saveDmode[0]=dMode[0]; + saveDmode[1]=dMode[1]; } dMode[0]=healthScreen; + dMode[1]=tripScreen; secsNoTouch=2;// Keep display on a few seconds sMode=0; userIdle=false; @@ -872,8 +876,8 @@ wait5secs=5; getGids=true; if (showHealth&&!playbackOpen){ - if (saveDmode==99){ - saveDmode=dMode[0]; + if (saveDmode[0]==99){ + saveDmode[0]=dMode[0]; } dMode[0]=healthScreen; } @@ -882,9 +886,13 @@ laccOn=accOn; if(!accOn&&userIdle&&!playbackEn){ // Car off and no user activity - turn off screen dled = 0; - if (saveDmode<99){ - dMode[0]=saveDmode; - saveDmode=99; + if (saveDmode[0]<99){ + dMode[0]=saveDmode[0]; + saveDmode[0]=99; + } + if (saveDmode[1]<99){ + dMode[1]=saveDmode[1]; + saveDmode[1]=99; } }else if(!headlights){ dled = ledHi; @@ -910,9 +918,9 @@ } } //remove health screen once moving - if(moving&&(saveDmode<99)&&(wait5secs==0)){ - dMode[0]=saveDmode; - saveDmode=99; + if(moving&&(saveDmode[0]<99)&&(wait5secs==0)){ + dMode[0]=saveDmode[0]; + saveDmode[0]=99; } //compute historic efficiency