Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Revision:
75:77bd26829dca
Parent:
74:e491e92b0bef
Child:
76:fb6779d0963e
--- a/main.cpp	Mon Apr 15 11:40:25 2013 +0000
+++ b/main.cpp	Mon Apr 15 14:33:53 2013 +0000
@@ -64,9 +64,10 @@
 unsigned char battData[256]={0};
 unsigned char msgChanged[100]; // inidcates which bytes changed
 char c;
-volatile int writePointer = 0;
-volatile int secsNoMsg = 0;
-volatile int secsNoTouch = 0;
+volatile unsigned short writePointer = 0;
+unsigned short readPointer=0;
+volatile unsigned short secsNoMsg = 0;
+volatile unsigned short secsNoTouch = 0;
 volatile bool canIdle;
 volatile bool userIdle;
 bool touched=false; //flag to read touchscreen
@@ -119,7 +120,6 @@
 unsigned short pointerSep;
 
 int main() {
-    int readPointer=0;
     char sTemp[40];
     unsigned long secs;
     unsigned char i,j,display=0,lwt=0;
@@ -273,11 +273,12 @@
                     spkr.beep(1000,0.25);
                     logEn=false;
                 } else {
-                    if (pointerSep>(maxBufLen*7/8)) { // Hi-water mark
-                        sprintf(sTemp,"Write buffer overrun.\n");
-                        logMsg(sTemp); // write buffer overrun
-                        spkr.beep(1000,0.25);
-                    }
+                    //moved overrun detection to the write code in utility.cpp
+                    //if (pointerSep>(maxBufLen*7/8)) { // Hi-water mark
+                    //    sprintf(sTemp,"Write buffer overrun.\n");
+                    //    logMsg(sTemp); // write buffer overrun
+                    //    spkr.beep(1000,0.25);
+                    //}
                     while (readPointer != writePointer) {
                         for (j = 0; j<13; j++){
                             fprintf(file,"%c",writeBuffer[readPointer][j]);