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:
Mon Jul 01 01:58:36 2013 +0000
Branch:
Metric
Parent:
111:d1559bb25c43
Child:
113:f388b4505463
Commit message:
Fixed lockup bug when USB already present

Changed in this revision

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/main.cpp	Sun Jun 30 23:04:56 2013 +0000
+++ b/main.cpp	Mon Jul 01 01:58:36 2013 +0000
@@ -24,7 +24,7 @@
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
 
-char revStr[7] = "111"; // gg - revision string, max 6 characters
+char revStr[7] = "112"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -223,7 +223,7 @@
     secsNoTouch=2;
     while (true) {
         if (!logOpen) { // Open new file if one is not already open
-            if(logEn&&usbEn&&!waitasec){ //logging enables and USB device detected
+            if(logEn&&usbEn){ //logging enables and USB device detected
                 strftime(fileName, 32, "%m%d%H%M.alc", &t); //mmddhhmm.alc
                 efr = f_open(&efile,fileName,FA_WRITE|FA_OPEN_ALWAYS);
                 seconds = time(NULL);
@@ -694,7 +694,8 @@
                 kWh_trip[0]=0;
                 if (repeatPoll) { // Poll on startup if autopoll enabled
                     logOnce=true;
-                    sendReq();
+                    reqMsgCnt=0;
+                    msgReq.attach(&sendReq,0.015);
                 }
             }
             laccOn=accOn;
@@ -763,7 +764,7 @@
                 }
                 logPackVoltages(); // Turbo3, only call
             }
-            if(!usbEn){
+            if(!usbEn&&!waitasec){
                 usbEn=detectUSB(); // Keep looking if none found
             }
             waitasec=false; // work around to avoid hang when USB tries to init immediately
--- a/utility.cpp	Sun Jun 30 23:04:56 2013 +0000
+++ b/utility.cpp	Mon Jul 01 01:58:36 2013 +0000
@@ -310,10 +310,8 @@
             packA -= 1; //Slight correction to value required (unique to my Leaf?)
             imWs_x4 = packV; // Volts*milliSeconds*2
             imWs_x4 *= -packA; // milliWattseconds*4
-            //if (!((imotorRPM<2)&&(imWs_x4<0))){ //Ignore if charging from wall
                 mWs_x4 += imWs_x4; // total mWs_x4
                 numWsamples++;
-            //}
         }else if((mType==1)&&(canRXmsg.id==0x1da)){ //Motor Speed
             imotorRPM=((canRXmsg.data[4]<<8)|(canRXmsg.data[5]));
             if(imotorRPM<0){ // take absolute value