test fork

Dependencies:   SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary_9341 by Tick Tock

Files at this revision

API Documentation at this revision

Comitter:
TickTock
Date:
Fri May 03 11:25:03 2013 +0000
Parent:
93:c2402e8cd0e2
Child:
95:248b3c25a7df
Commit message:
Cleaned up dte miles remaining display (right justified and clear old values better)

Changed in this revision

TFT_fonts.lib Show annotated file Show diff for this revision Revisions of this file
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
--- a/TFT_fonts.lib	Wed May 01 03:02:59 2013 +0000
+++ b/TFT_fonts.lib	Fri May 03 11:25:03 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/TickTock/code/TFT_fonts/#49b5ef080441
+http://mbed.org/users/TickTock/code/TFT_fonts/#af72b26394d8
--- a/displayModes.cpp	Wed May 01 03:02:59 2013 +0000
+++ b/displayModes.cpp	Fri May 03 11:25:03 2013 +0000
@@ -866,14 +866,16 @@
         tt.foreground(Green);
         if (showMiles){
             float miles = mpkWh[dtePeriod]*((float)(gids-5)*.075);
-            tt.locate(160,8);
             // Right justify
-            if (miles>99.9){
-                printf("%4.1f \n",miles);
+            if (miles>99.9){ //space=18; num=31; . = 23
+                tt.locate(161,8);
+                printf("%4.1f\n",miles);
             } else if (miles>9.9){
-                printf(" %3.1f \n",miles);
+                tt.locate(156,8);
+                printf("  %3.1f\n",miles);
             } else {
-                printf("  %2.1f \n",miles);
+                tt.locate(151,8);
+                printf("    %2.1f\n",miles);
             }
         } else {
             tt.locate(180,10);
--- a/main.cpp	Wed May 01 03:02:59 2013 +0000
+++ b/main.cpp	Fri May 03 11:25:03 2013 +0000
@@ -5,7 +5,6 @@
 // * Ability to update binary from the thumb-drive (requires file timestamp)
 // * Audible friction brake feedback
 // * User-configurable watchpoint
-// * Better graphical DTE display with historic efficiency information considered and displayed
 // * Add 50% charge option
 // * Tire Pressure Sensor display
 // * Fix bug in playback while connected to canbus (hangs)
@@ -51,7 +50,7 @@
 // gg - revStr is used in 2 places
 // gg - and is easy to edit here
 // gg - added ZeroSecTick and revStr
-char revStr[7] = "93";
+char revStr[7] = "94";
 
 bool debugMode = false;
 bool logEn = false, logOpen = false; 
@@ -229,9 +228,6 @@
     // Read config file
     readConfig();
 
-    // Start 15ms timer for requests
-    //msgReq.attach(&sendReq,0.015);
-
     // Start monitors
     can1.monitor(true); // set to snoop mode
     can2.monitor(true); // set to snoop mode
@@ -253,7 +249,8 @@
                 //sprintf(sTemp,"Using file %s\n",fileName);
                 //printMsg(sTemp); // using alc file ...
                 file = fopen(fileName, "ab");
-                lastDMode[whichTouched]=99;//force refresh
+                lastDMode[0]=99;//force refresh
+                lastDMode[1]=99;//force refresh
                 if(file==NULL){
                     sprintf(sTemp,"\nUnable to open %s\n\n\n\n",fileName);
                     printMsg(sTemp); // cannot open alc file
@@ -427,13 +424,13 @@
                                     dMode[whichTouched] = brakeScreen ; // GoTo Brake Screen
                                 } else if (dMode[whichTouched]==cpScreen) {
                                     reqMsgCnt=0;
-                                    msgReq.attach(&sendReq,0.025);
+                                    msgReq.attach(&sendReq,0.015);
                                 } else if (dMode[whichTouched]==cpHistScreen) { // gg - hist
                                     reqMsgCnt=0;
-                                    msgReq.attach(&sendReq,0.025);
+                                    msgReq.attach(&sendReq,0.015);
                                 } else if (dMode[whichTouched]==cpBarScreen) { // gg - cpbars
                                     reqMsgCnt=0;
-                                    msgReq.attach(&sendReq,0.025);
+                                    msgReq.attach(&sendReq,0.015);
                                 } else if (dMode[whichTouched]==config1Screen) {
                                     mbed_reset();
                                 } else if (dMode[whichTouched]==playbackScreen) { // pause/unpause
--- a/utility.cpp	Wed May 01 03:02:59 2013 +0000
+++ b/utility.cpp	Fri May 03 11:25:03 2013 +0000
@@ -370,55 +370,12 @@
     }
 }
 
-/*void sendCPreq() {
-    char i;
-    char data[8] = {0x02, 0x21, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff};
-    can1.monitor(false); // set to active mode
-    can1SleepMode = 0; // enable TX
-    can1.write(CANMessage(0x79b, data, 8));
-    
-    if( ZeroSecTick ) { ZeroSecTick = false; logTS(); } // gg - 0-second EV bus
-    
-    logCan(1,CANMessage(0x79b, data, 8)); // Group 2 Request on EV
-    data[0]=0x30; //change to request next line message
-    data[1]=0x01;
-    data[2]=0x00;
-    for(i=0;i<29;i++){
-        wait_ms(16); //wait 16ms
-        can1.write(CANMessage(0x79b, data, 8));
-    }
-    can1SleepMode = 1; // disable TX
-    can1.monitor(true); // set to snoop mode
-}
-
-void sendTreq() {
-    char i;
-    char data[8] = {0x02, 0x21, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff};
-    can1.monitor(false); // set to active mode
-    can1SleepMode = 0; // enable TX
-    can1.write(CANMessage(0x79b, data, 8));
-    
-    if( ZeroSecTick ) { ZeroSecTick = false; logTS(); } // gg - 0-second EV bus
-    
-    logCan(1,CANMessage(0x79b, data, 8)); // Group 4 request on EV
-    data[0]=0x30; //change to request next line message
-    data[1]=0x01;
-    data[2]=0x00;
-    for(i=0;i<3;i++){
-        wait_ms(16); //wait 16ms
-        can1.write(CANMessage(0x79b, data, 8));
-    }
-    can1SleepMode = 1; // disable TX
-    can1.monitor(true); // set to snoop mode
-}
-
-void autoPollISR() {  //This is the ticker ISR for auto-polling
-    pollCP=true;    //Set a flag to do in main loop instead of here
-}                   //since ticker blocks other interrupts*/
-
 void autoPollISR(){
+    char sTemp[40]; // just for debug
+    sprintf(sTemp,"Requesting cp data\n"); // just for debug
+    printMsg(sTemp); // just for debug
     reqMsgCnt = 0; //reset message counter
-    msgReq.attach(&sendReq,0.025);
+    msgReq.attach(&sendReq,0.015);
 }
 
 void playbackISR() { //Used for autoplayback