Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary by
Diff: displayModes.cpp
- Revision:
- 177:6fda79c2fda1
- Parent:
- 175:0357b4159b40
- Child:
- 178:bf6404312c45
--- a/displayModes.cpp Mon Feb 17 02:39:54 2014 +0000 +++ b/displayModes.cpp Thu Mar 06 15:37:40 2014 +0000 @@ -80,15 +80,16 @@ // worst-case DTE // Compute DTE based on worst saved trip efficiency (without climate control) and adding the impact // of the current climate control power relative to the last 10 minutes of driving - dte=convertDistance((minTripEff-mpkWh_noCC+mpkWh[dtePeriod])*useable_kWh); //LM - add metric conversion - tt.foreground(Green); - tt.locate(10,84); - if(dte>=9.5){ - printf("%2.0f \n",dte); - }else{ - printf("%2.1f \n",dte); + if(maxTripEff>0){// Skip if no data available + dte=convertDistance((minTripEff-mpkWh_noCC+mpkWh[dtePeriod])*useable_kWh); //LM - add metric conversion + tt.foreground(Green); + tt.locate(10,84); + if(dte>=9.5){ + printf("%2.0f \n",dte); + }else{ + printf("%2.1f \n",dte); + } } - // 10-minute DTE tt.set_font((unsigned char*) SCProSB31x55); tt.foreground(Yellow); @@ -133,17 +134,19 @@ tt.set_font((unsigned char*) Arial28x28); // Compute DTE based on best saved trip efficiency (without climate control) and adding the impact // of the current climate control power relative to the last 10 minutes of driving - dte=convertDistance((maxTripEff-mpkWh_noCC+mpkWh[dtePeriod])*useable_kWh); //LM - add metric conversion - tt.foreground(Orange); - if(dte>=99.5){ - tt.locate(255,84); - printf("%3.0f \n",dte); - }else if(dte>=9.5){ - tt.locate(270,84); - printf("%2.0f \n",dte); - }else{ - tt.locate(265,84); - printf("%2.1f \n",dte); + if(maxTripEff>0){// Skip if no data available + dte=convertDistance((maxTripEff-mpkWh_noCC+mpkWh[dtePeriod])*useable_kWh); //LM - add metric conversion + tt.foreground(Orange); + if(dte>=99.5){ + tt.locate(255,84); + printf("%3.0f \n",dte); + }else if(dte>=9.5){ + tt.locate(270,84); + printf("%2.0f \n",dte); + }else{ + tt.locate(265,84); + printf("%2.1f \n",dte); + } } lmpkWh=mpkWh[dtePeriod]; } //!(force||gids!=lgids||mpkWh[dtePeriod]!=lmpkWh) @@ -377,7 +380,8 @@ lkWh=(int)(kWh_trip[0]*100); } if(showButtons){ - showButton(3,2," Reset"," ",4,4); + showButton(3,1," Cancel"," Day",4,4); + showButton(3,2," Reset","Custom",4,4); } } @@ -421,8 +425,8 @@ }*/ if(force||gids!=lgids){ tt.locate(10,10); - if((gids+5)<startGids){ // Wh/gid, too, if trip long enough - printf("%d gids (%0.0f)\n",gids,1000*(kWh_trip[0]+CCkWh_trip[0])/(startGids-gids)); + if(dailyGids>5){ // Wh/gid, too + printf("%d gids (%0.0f)\n",gids,1000*(kWh_trip[3]+CCkWh_trip[3])/dailyGids); }else{ printf("%d gids \n",gids); }