Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Files at this revision

API Documentation at this revision

Comitter:
TickTock
Date:
Sun Jul 21 11:08:38 2013 +0000
Branch:
Metric
Parent:
124:0d622967b764
Commit message:
Re-centered efficiency screen

Changed in this revision

displayModes.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
utility.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0d622967b764 -r f58b7ab2abee displayModes.cpp
--- a/displayModes.cpp	Sat Jul 20 03:37:28 2013 +0000
+++ b/displayModes.cpp	Sun Jul 21 11:08:38 2013 +0000
@@ -1027,8 +1027,8 @@
         tt.set_font((unsigned char*) Arial24x23);
         //for(i=0;i<10;i++){
             //y=200-i*20;
-        for(i=3;i<8;i++){
-            y=200-(i-3)*40;
+        for(i=2;i<7;i++){
+            y=200-(i-2)*40;
             tt.locate(0,y-8);
             if (showMiles){
                 printf("%3.0f\n",convertDistance(i*((float)(gids-5)*.075))); // LM - Added metric support
@@ -1041,8 +1041,8 @@
         lgids=gids;    
     }
     if(tock||force){
-        for(i=3;i<8;i++){
-            y=200-(i-3)*40;
+        for(i=2;i<7;i++){
+            y=200-(i-2)*40;
             tt.line(40,y,158,y,DarkGrey);
         }
 
@@ -1112,11 +1112,11 @@
                 radius=2;
                 color=Green;
             }
-            if(y<100){
+            if(y<60){
                 y=220;
                 color=Red;
-            }else if(y<320) {
-                y=320-y;
+            }else if(y<280) {
+                y=280-y;
             }else{
                 y=0;
             }
diff -r 0d622967b764 -r f58b7ab2abee main.cpp
--- a/main.cpp	Sat Jul 20 03:37:28 2013 +0000
+++ b/main.cpp	Sun Jul 21 11:08:38 2013 +0000
@@ -4,12 +4,11 @@
 // * Audible friction brake feedback
 // * User-configurable watchpoint
 // * Add 50% charge option
-// * Tire Pressure Sensor display
-// * Fix bug in playback while connected to canbus (hangs)
 // * Add coasting regen to regen/braking display
 // * Change semilog efficiency graph to linear with 10 minute values
 // * Add additional 79b bank readouts
 // * Add ability to transfer settings config file to/from USB
+// * Subtract accessory power from efficiency history (add back in when displaying)
 
 #include "mbed.h"
 #include "CAN.h"
@@ -21,7 +20,7 @@
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
 
-char revStr[7] = "124"; // gg - revision string, max 6 characters
+char revStr[7] = "125"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -514,7 +513,9 @@
                                 } else if (dMode[whichTouched]==playbackScreen) {
                                     // Start/stop playback
                                     if(!playbackOpen){
-                                        if(!logOpen){
+                                        if(!canIdle){
+                                            printMsg("Cannot playback while connected to canbus\n");
+                                        }else if(!logOpen){
                                             efr = f_open(&efile,"playback.alc",FA_READ|FA_OPEN_EXISTING);
                                             lastDMode[whichTouched]=99;//force refresh
                                             if(efr != FR_OK){
diff -r 0d622967b764 -r f58b7ab2abee utility.cpp
--- a/utility.cpp	Sat Jul 20 03:37:28 2013 +0000
+++ b/utility.cpp	Sun Jul 21 11:08:38 2013 +0000
@@ -745,14 +745,15 @@
         f_printf(&bfile,"%s,",sTemp);           
         f_printf(&bfile,"%d,%d,%d,%d,",(battData[(BatDataBaseG4*7)+ 3]<<8)+battData[(BatDataBaseG4*7)+ 4],battData[(BatDataBaseG4*7)+ 5],(battData[(BatDataBaseG4*7)+ 6]<<8)+battData[(BatDataBaseG4*7)+ 7],battData[(BatDataBaseG4*7)+ 8]);
         f_printf(&bfile,"%d,%d,%d,%d", (battData[(BatDataBaseG4*7)+ 9]<<8)+battData[(BatDataBaseG4*7)+10],battData[(BatDataBaseG4*7)+11],(battData[(BatDataBaseG4*7)+12]<<8)+battData[(BatDataBaseG4*7)+13],battData[(BatDataBaseG4*7)+14]);
-        for(i=0; i<96; i++) {
+        /*for(i=0; i<96; i++) {
             bd=(battData[BatDataBaseG2*7+i*2+3]<<8)+battData[BatDataBaseG2*7+i*2+4];
             f_printf(&bfile,",%d",bd);
-        }
+        }*/
         // temporariliy dump everything
-        /*for(i=0; i<BatDataBufMax; i++) {
-            f_printf(&bfile,",%02x",battData[i]);
-        }*/
+        for(i=0; i<BatDataBufMax; i++) {
+            sprintf(sTemp,",%02x",battData[i]);
+            f_printf(&bfile,"%s",sTemp);
+        }
 
         f_printf(&bfile,"\r\n");
         f_close(&bfile);