Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Branch:
Metric
Revision:
119:0e2b641e98a2
Parent:
118:02010b18efdc
Child:
120:041edeec08f5
--- a/main.cpp	Fri Jul 05 15:38:40 2013 +0000
+++ b/main.cpp	Fri Jul 05 16:55:04 2013 +0000
@@ -23,13 +23,14 @@
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
 
-char revStr[7] = "118"; // gg - revision string, max 6 characters
+char revStr[7] = "119"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
 bool waitasec = true;
 unsigned char wait5secs = 5;
 // to write to USB Flash Drives, or equivalent (SD card in Reader/Writer)
+// class10 SDcard in Reader/Writer recommended
 FRESULT mfr = f_mount(0,&USBdrive);
 time_t seconds ;
 
@@ -122,7 +123,7 @@
 float mph[39]={0};
 float kW[39]={0};
 float mpkWh[39]={0};
-float unloadedVavg,unloadedV,Resr,Rlms,redRlms,incRlms;
+float unloadedVavg_x2,unloadedV_x2,Resr,Rlms,redRlms,incRlms;
 // Logarithmic division scale (roughly - snapped to common units of time)
 float timeConstant[39] = {1, 1.58, 2.51, 3.98, 6.31, 10, 15.8, 25.1, 39.8, 60, // 1 minute
                      60*1.58, 60*2.51, 60*3.98, 60*6.31, 60*10, 60*15.8, 60*25.1, 60*39.8, 60*60, // 1 hour
@@ -724,7 +725,7 @@
                 if (mpkWh[0]<0) {
                     mpkWh[0]=99;// negative means inf.
                 }
-                unloadedV = unloadedVavg/numWsamples;
+                unloadedV_x2 = unloadedVavg_x2/numWsamples;
                 //Rlms /= numWsamples; //unecessary
                 //redRlms /= numWsamples;
                 //incRlms /= numWsamples;
@@ -736,10 +737,6 @@
             } else {
                 kW[0]=0;
                 mpkWh[0]=0;
-                unloadedVavg=0;
-                Rlms=0;
-                redRlms=0;
-                incRlms=0;
             }
             kWh_trip[0]+=kW[0]/3600;
             kWh_trip[1]+=kW[0]/3600;
@@ -747,6 +744,10 @@
             motorRPM=0;
             numSsamples=0;
             mWs_x4=0;
+            unloadedVavg_x2=0;
+            Rlms=0;
+            redRlms=0;
+            incRlms=0;
             numWsamples=0;
             if(accOn||playbackEn){
                 for(i=1;i<39;i++){