Dual CANbus monitor and instrumentation cluster supporting ILI9341 display controller

Dependencies:   SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed

Fork of CANary by Tick Tock

Revision:
162:c6545fc0164a
Parent:
161:71ac85d11f03
Child:
163:3b6fab958773
--- a/main.cpp	Thu Nov 21 14:17:35 2013 +0000
+++ b/main.cpp	Thu Nov 21 23:08:00 2013 +0000
@@ -7,9 +7,9 @@
 // * 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?)
 
-// rev161
-// * Subtract climate control power from stored efficiency data and add current CC power back in for display
-// * Added X axis labels on CP histogram and scaled bar width
+// rev162
+// Fixed efficiency screen discontinuity when CC power changes
+// Added DTE & efficiency w/o CC to efficiency display
 
 #include "mbed.h"
 #include "CAN.h"
@@ -19,7 +19,7 @@
 #include "utility.h"
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
-char revStr[7] = "161"; // gg - revision string, max 6 characters
+char revStr[7] = "162"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -132,6 +132,7 @@
 float mph[39]={0};
 float kW[39]={0};
 float mpkWh[39]={0};
+float mpkWh_noCC=0;
 float unloadedV_x2,Resr,curRmax,curRmin,redRmax,redRmin,incRmax,incRmin;
 signed short Imax, Imin;
 // Logarithmic division scale (roughly - snapped to common units of time)
@@ -878,6 +879,7 @@
                     average=kW[i]/timeConstant[i];
                     kW[i]-=average;
                     kW[i]+=kW[0];
+                    if(i==dtePeriod) mpkWh_noCC=mpkWh[i]/average; // compute efficiency w/o CC for dtePeriod
                     average+=CCkW; //add climate control power back in for display
                     mpkWh[i]/=average;
                     if (mpkWh[i]<0) {