Dual CANbus monitor and instrumentation cluster supporting ILI9341 display controller

Dependencies:   SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed

Fork of CANary by Tick Tock

Branch:
Metric
Revision:
117:49883c779a74
Parent:
116:5cd72bae7c12
Child:
118:02010b18efdc
--- a/utility.cpp	Thu Jul 04 05:27:15 2013 +0000
+++ b/utility.cpp	Thu Jul 04 18:01:52 2013 +0000
@@ -83,6 +83,9 @@
                     
                     // overlay the last message with a "Lost0002" comment
                     writeBuffer[tempWritePointer][0]=0;
+                    // leave the ts of the overlaid message
+                    //writeBuffer[tempWritePointer][1]=(ts&0xff00)>>8; // Time Stamp (2 bytes_
+                    //writeBuffer[tempWritePointer][2]=(ts&0x00ff);
                     // force the MsgID to an Event Message 
                     writeBuffer[tempWritePointer][3]=0xfe; // MsgID, low byte
                     writeBuffer[tempWritePointer][4]=0xff; // Len nibble, and MsgID high nibble
@@ -162,11 +165,11 @@
             for(i=5;i<13;i++){ // Is there a better way to do this? (writeBuffer[localWritePointer][5]=canRXmsg.data?)
                 writeBuffer[localWritePointer][i]=canRXmsg.data[i-5];
             }
-            //if (localWritePointer==readPointer) { //Just caught up to read pointer
-            //    printMsg("Write buffer overrun.\n");
-            //    spkr.beep(500,0.125);
-            //}
-            swInt=1; // trigger buffer dump
+            if (writePointer==readPointer) {
+                // Just caught up to read pointer
+                printMsg("Write buffer overrun.\n"); // write buffer overrun
+                spkr.beep(500,0.25);
+            }
         }
     }
 
@@ -390,6 +393,9 @@
 }
 
 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.015);
 }
@@ -795,32 +801,3 @@
     }
     return(usbEn);
 }
-
-void dumpBuffer(void){
-    int localWritePointer=writePointer;
-    //NVIC_DisableIRQ(EINT0_IRQn);
-    //NVIC_DisableIRQ(EINT1_IRQn);
-    //NVIC_DisableIRQ(EINT2_IRQn);
-    //NVIC_DisableIRQ(EINT3_IRQn);
-    while (readPointer != localWritePointer) {
-        FRESULT efr=f_write(&efile,&writeBuffer[readPointer][0],13,&bytesRW);
-        if (efr != FR_OK) {
-            logOpen = false;
-            printMsg("Failed to append log file.\n"); // failed to append 
-            spkr.beep(3000,0.25);
-            spkr.beep(1500,0.25);
-            spkr.beep(750,0.25);
-            spkr.beep(375,0.25);
-            logEn=false;
-        }
-        if(++readPointer >= maxBufLen){
-            readPointer=0;
-            led4 = !led4;
-        }
-    }
-    swInt=0;
-    //NVIC_EnableIRQ(EINT0_IRQn);
-    //NVIC_EnableIRQ(EINT1_IRQn);
-    //NVIC_EnableIRQ(EINT2_IRQn);
-    //NVIC_EnableIRQ(EINT3_IRQn);
-}
\ No newline at end of file