Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Branch:
Metric
Revision:
124:0d622967b764
Parent:
123:a8c0042df617
Child:
125:f58b7ab2abee
--- a/main.cpp	Fri Jul 19 12:48:10 2013 +0000
+++ b/main.cpp	Sat Jul 20 03:37:28 2013 +0000
@@ -10,7 +10,6 @@
 // * 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
-// * Is CAN/EV designator reversed in canlog?
 
 #include "mbed.h"
 #include "CAN.h"
@@ -22,7 +21,7 @@
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
 
-char revStr[7] = "123"; // gg - revision string, max 6 characters
+char revStr[7] = "124"; // gg - revision string, max 6 characters
 
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -69,7 +68,7 @@
 char indexLastMsg[0x800]={0}; // index table for last message
 CANMessage lastMsg[100]; // table to store last message of eachtype
 
-unsigned char queryData[DataBufMax]={0}; // 7 * 0x3D = DataBufMax
+unsigned char battData[BatDataBufMax]={0}; // 7 * 0x3D = BatDataBufMax
 
 unsigned char msgChanged[100]; // inidcates which bytes changed
 char c;
@@ -140,14 +139,13 @@
 bool metric = false;
 bool shunt[96]={0};
 bool charging=false;
-bool reqRest=false;
+
 int main() {
     //can1SleepMode.mode(OpenDrain);
     //can2SleepMode.mode(OpenDrain);
     char sTemp[40];
     unsigned long secs;
     unsigned char i,j,display=0,lwt=0;
-    char reqData[8] = {0x30, 0x00, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff};
     point lastTouch;
     float average;
     tt.set_orientation(1);
@@ -333,8 +331,7 @@
                 logTS(); // Date-Time at wakeup
             }
             if (repeatPoll) { // re-enable autopolling if enabled
-                //autoPoll.attach(&autoPollISR,pollInt);
-                autoPoll.attach(&autoPollISR,10);
+                autoPoll.attach(&autoPollISR,pollInt);
             }
         } // if idle
         
@@ -421,13 +418,13 @@
                                     dMode[whichTouched] = brakeScreen ; // GoTo Brake Screen
                                 } else if (dMode[whichTouched]==cpScreen) {
                                     reqMsgCnt=0;
-                                    msgReq.attach(&sendReq,0.035);
+                                    msgReq.attach(&sendReq,0.015);
                                 } else if (dMode[whichTouched]==cpHistScreen) { // gg - hist
                                     reqMsgCnt=0;
-                                    msgReq.attach(&sendReq,0.035);
+                                    msgReq.attach(&sendReq,0.015);
                                 } else if (dMode[whichTouched]==cpBarScreen) { // gg - cpbars
                                     reqMsgCnt=0;
-                                    msgReq.attach(&sendReq,0.035);
+                                    msgReq.attach(&sendReq,0.015);
                                 } else if (dMode[whichTouched]==configScreen) {
                                     mbed_reset();
                                 } else if (dMode[whichTouched]==playbackScreen) { // pause/unpause
@@ -671,15 +668,6 @@
             }
         }
 
-        if (reqRest){
-            reqRest=false;
-            if (reqMsgCnt<DataBaseG7){
-                can1.write(CANMessage(0x79b, reqData, 8));
-            }else{
-                can1.write(CANMessage(0x745, reqData, 8));
-            }
-        }
-
         if(tick){ // Executes once a second
             tick=false;
             headlights = (lastMsg[indexLastMsg[0x358]].data[1]&0x80)?true:false;  // headlight/turn signal indicator
@@ -717,7 +705,7 @@
                 if (repeatPoll&&(wait5secs==0)) { // Poll on startup if autopoll enabled
                     logOnce=true;
                     reqMsgCnt=0;
-                    msgReq.attach(&sendReq,0.035);
+                    msgReq.attach(&sendReq,0.015);
                 }
             }