Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary by Tick Tock

Files at this revision

API Documentation at this revision

Comitter:
TickTock
Date:
Tue Aug 06 01:26:17 2013 +0000
Parent:
143:88b5155622a5
Child:
145:47cdacc468a4
Commit message:
added accessory volt read from battData; put a copy of the config.txt on the USB drive during firmware update; added current trip efficiency below 10 minute efficiency to dte display;

Changed in this revision

displayModes.cpp Show annotated file Show diff for this revision Revisions of this file
displayModes.h 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
--- a/displayModes.cpp	Mon Aug 05 03:34:06 2013 +0000
+++ b/displayModes.cpp	Tue Aug 06 01:26:17 2013 +0000
@@ -35,11 +35,6 @@
             tt.locate(16,10);
             tt.foreground(White);
             printf("%3d gids \n",gids);
-            if(debugMode){
-                if(pointerSep>maxPS){maxPS=pointerSep;}
-                tt.locate(10,70);
-                printf("%3d sep %3d max\n",pointerSep,maxPS);
-            }
             tt.locate(10,40);
             tt.foreground(Cyan);
             useable_kWh = (float)(gids-5)*0.075;
@@ -47,6 +42,11 @@
                 useable_kWh=0;
             }
             printf("%4.1f kWh \n",useable_kWh);
+            if(debugMode){
+                if(pointerSep>maxPS){maxPS=pointerSep;}
+                tt.locate(10,110);
+                printf("%3d sep  %3d max\n",pointerSep,maxPS);
+            }
 
             // Display DTE
             dte=convertDistance(minTripEff*useable_kWh);
@@ -145,7 +145,11 @@
         if(force||accV!=laccV){
             tt.locate(20,176);
             tt.foreground(Yellow);
-            printf("%3.1f(%3.1f)  \n",accV,accV2);
+            if(debugMode){
+                printf("%4.2f %4.2f \n",accV,accV2);
+            }else{
+                printf("%3.1fV  \n",accV);
+            }
             laccV=accV;
         }
         if(force||tireP!=ltireP){
@@ -422,10 +426,6 @@
     short steerOutBounds = 0 ;
     CANMessage msg;
 
-//        tt.set_font((unsigned char*) Arial12x12_prop);  // select the font
-//        tt.locate(10,40);
-//        printf("%d \n",chirpInt);
-
     //---------------
     msg = lastMsg[indexLastMsg[0x180]]; //Get Throttle position
     throttle = msg.data[5];
@@ -1112,7 +1112,6 @@
         toVal=24;// no need to constantly update the long tc values
     }
     if(force||lgids!=gids){ // update Y axis when kWh changes
-        //tt.set_font((unsigned char*) Arial12x12);
         tt.set_font((unsigned char*) Arial24x23);
         //for(i=0;i<10;i++){
             //y=200-i*20;
@@ -1121,7 +1120,6 @@
             tt.locate(0,y-8);
             if (showMiles){
                 printf("%3.0f\n",convertDistance(i*((float)(gids-5)*.075))); // LM - Added metric support
-                //printf("%2.0f  \n",i*((float)(gids-5)*.075));
             }else{
                 printf("%d.0\n",i);
             }
@@ -1170,6 +1168,10 @@
         } else {
             tt.locate(200,10);
             printf("%3.1f \n",mpkWh[dtePeriod]);
+            tt.foreground(Cyan);
+            tt.set_font((unsigned char*) Arial24x23);
+            tt.locate(222,70);
+            printf("%2.1f \n",curEff);
         }
         lx=50;
         ly=mpkWh[0]*40;
--- a/displayModes.h	Mon Aug 05 03:34:06 2013 +0000
+++ b/displayModes.h	Tue Aug 06 01:26:17 2013 +0000
@@ -61,7 +61,7 @@
 extern bool showHealth;
 extern float maxTripEff, minTripEff;
 extern bool brakeMon;
-//extern unsigned short chirpInt;
+extern float curEff;
 
 extern "C" {
     void printLast (bool force, bool showButtons);
--- a/main.cpp	Mon Aug 05 03:34:06 2013 +0000
+++ b/main.cpp	Tue Aug 06 01:26:17 2013 +0000
@@ -10,9 +10,10 @@
 // * Subtract accessory power from efficiency history (add back in when displaying)
 // * Add trip history display
 
-// rev143
+// rev144
 // added accessory volt read from battData
 // put a copy of the config.txt on the USB drive during firmware update
+// added current trip efficiency below 10 minute efficiency to dte display
 
 #include "mbed.h"
 #include "CAN.h"
@@ -23,7 +24,7 @@
 #include "utility.h"
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
-char revStr[7] = "143"; // gg - revision string, max 6 characters
+char revStr[7] = "144"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -123,6 +124,7 @@
 unsigned char dtePeriod = 14; //ten minute averaging interval
 float kWh_trip[3]={0};
 float miles_trip[3]={0};
+float curEff = 0;
 float maxTripEff = 4;
 float minTripEff = 4;
 float mph[39]={0};
@@ -702,6 +704,7 @@
 
         if(tick){ // Executes once a second
             tick=false;
+            curEff = miles_trip[0]/kWh_trip[0];
             headlights = (lastMsg[indexLastMsg[0x358]].data[1]&0x80)?true:false;  // headlight/turn signal indicator
             if(indexLastMsg[0x355]>0){
                 miles_kmbar = (lastMsg[indexLastMsg[0x355]].data[4]&0x20)?true:false;  // indicates selected distance units
@@ -723,12 +726,11 @@
                 }
                 // Keep track of max and min trip efficiency
                 if (miles_trip[0]>3){ // Ignore very short trips
-                    float tmpeff = miles_trip[0]/kWh_trip[0];
-                    if (maxTripEff<tmpeff) {
-                        maxTripEff=tmpeff;
+                    if (maxTripEff<curEff) {
+                        maxTripEff=curEff;
                     }
-                    if (minTripEff>tmpeff) {
-                        minTripEff=tmpeff;
+                    if (minTripEff>curEff) {
+                        minTripEff=curEff;
                     }
                 }
                 if (repeatPoll) { // Log on shutdown if autopoll enabled
--- a/utility.cpp	Mon Aug 05 03:34:06 2013 +0000
+++ b/utility.cpp	Tue Aug 06 01:26:17 2013 +0000
@@ -1,7 +1,7 @@
 // utility.cpp
 #include "utility.h"
 unsigned long brkMonRate = 400000;
-unsigned short brkMonThr = 2000;
+unsigned short brkMonThr = 4000;
 
 void mbed_reset();
 
@@ -936,7 +936,7 @@
 
 //Sample CONFIG.TXT
 /*
-format 5
+format 7
 x0_off 5732
 y0_off 34009
 x0_pp 77
@@ -955,10 +955,10 @@
 skin 0
 dtePeriod 14
 DebugMode 0
-brakeMon 0
+metric 0
 firmware 11
 showHealth 1
 brakeMon 1
 brkMonRate 400000
-brkMonThr 2000
+brkMonThr 4000
 */
\ No newline at end of file