Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Revision:
79:68f0dd8d1f19
Parent:
78:a383971fe02f
--- a/utility.cpp	Tue Apr 16 13:01:13 2013 +0000
+++ b/utility.cpp	Tue Apr 16 22:31:47 2013 +0000
@@ -135,6 +135,7 @@
         if(packA>0x03ff){
             packA|=0xf800;//extend sign;
         }
+        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
@@ -190,36 +191,37 @@
             case 0:
                 can1.monitor(false); // set to active mode
                 can1SleepMode = 0; // enable TX
-                data[0]=0x02; //change to request frame 1
+                data[0]=0x02; //change to request group 1
                 data[1]=0x21;
                 data[2]=0x01;
                 break;
-            case 6: // frame 1 has 6 lines
+            case 6: // group 1 has 6 frames
                 can1.monitor(false); // set to active mode
                 can1SleepMode = 0; // enable TX
-                data[0]=0x02; //change to request frame 2 (cp data)
+                data[0]=0x02; //change to request group 2 (cp data)
                 data[1]=0x21;
                 data[2]=0x02;
                 break;
-            case 35: // frame 2 has 29 lines
-                data[0]=0x02; //change to request frame 3
+            case 35: // group 2 has 29 frames
+                data[0]=0x02; //change to request group 3
                 data[1]=0x21;
                 data[2]=0x03;
                 break;
-            case 40: // frame 3 has 5 lines
-                data[0]=0x02; //change to request frame 4 (temperature)
+            case 40: // group 3 has 5 frames
+                data[0]=0x02; //change to request group 4 (temperature)
                 data[1]=0x21;
                 data[2]=0x04;
                 break;
-            case 43: // frame 4 has 3 lines
-                data[0]=0x02; //change to request frame 5
+            case 43: // group 4 has 3 frames
+                data[0]=0x02; //change to request group 5
                 data[1]=0x21;
                 data[2]=0x05;
                 break;
-            case 54: // frame 5 has 11 lines
+            case 54: // group 5 has 11 frames
                 reqMsgCnt = 99;
                 can1SleepMode = 1; // disable TX
                 can1.monitor(true); // set to snoop mode
+                msgReq.detach(); // stop ticker
             default:
                 data[0]=0x30; //change to request next line message
                 data[1]=0x01;
@@ -278,6 +280,7 @@
 
 void autoPollISR(){
     reqMsgCnt = 0; //reset message counter
+    msgReq.attach(&sendReq,0.015);
 }
 void playbackISR() { //Used for autoplayback
     step=true;