test fork

Dependencies:   SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary_9341 by Tick Tock

Revision:
156:4e5d30535cf9
Parent:
155:f31006516956
Child:
157:1a100a5ed06f
--- a/main.cpp	Sat Oct 19 15:38:44 2013 +0000
+++ b/main.cpp	Thu Oct 24 19:51:31 2013 +0000
@@ -2,7 +2,6 @@
 //
 //To Do:
 // * Add 50% charge option
-// * Add coasting regen to regen/braking display; fix regen display to show actual instead of target regen (EX: on 100% charge)
 // * Add linear efficiency graph with 10 minute values
 // * Subtract accessory power from efficiency history (add back in when displaying)
 // * Add in-device config editor
@@ -12,12 +11,9 @@
 // * Add heater activation warning message
 // * Add trip max/min efficiency reset
 
-// rev155
-// Added workoaround to hardware limitation where changing pwm frequency for sound sometimes also deactivated the screen backlight
-// Added ambient temperature to trip log
-// Save Resr in history file so it doesn't reset to 75mOhms on CANary reset
-// Changed regen to 1d5 message (appears to be closer to actual regen versus 1cb being target regen)
-// Fixed Resr formatting in trip log so it show 3 decimal places
+// rev156
+// Changed efficency screen braking monitor to use actual motor amps instead of target regen signal
+// Changed braking screen to use actual regen signal instead of target regen signal
 
 #include "mbed.h"
 #include "CAN.h"
@@ -27,7 +23,7 @@
 #include "utility.h"
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
-char revStr[7] = "155"; // gg - revision string, max 6 characters
+char revStr[7] = "156"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -731,7 +727,11 @@
 
         if(tick){ // Executes once a second
             tick=false;
-            curEff = miles_trip[0]/kWh_trip[0];
+            if (miles_trip[0]>0.25) {
+                curEff = miles_trip[0]/kWh_trip[0];
+            } else {
+                curEff = 0;
+            }
             headlights = (lastMsg[indexLastMsg[0x358]].data[1]&0x80)?true:false;  // headlight/turn signal indicator
             if(accOn&&indexLastMsg[0x355]>0){
                 miles_kmbar = (lastMsg[indexLastMsg[0x355]].data[4]&0x20)?true:false;  // indicates selected distance units