Dual CANbus monitor and instrumentation cluster

Dependencies:   SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed

Fork of CANary by Tick Tock

Revision:
77:7c136766466c
Parent:
75:77bd26829dca
Child:
78:a383971fe02f
Child:
80:24f1793171e7
--- a/utility.cpp	Mon Apr 15 14:40:05 2013 +0000
+++ b/utility.cpp	Tue Apr 16 03:28:55 2013 +0000
@@ -60,15 +60,15 @@
             for(i=5;i<13;i++){ // Is there a better way to do this? (writeBuffer[writePointer][i]=canRXmsg.data?)
                 writeBuffer[writePointer][i]=canRXmsg.data[i-5];
             }
+            if (++writePointer >= maxBufLen) {
+                writePointer = 0;
+                led3 = !led3;
+            }
             if (writePointer==readPointer) {
                 // Just overwrote an entry that hasn't been sent to thumbdrive
                 sprintf(sTemp,"Write buffer overrun.\n");
                 logMsg(sTemp); // write buffer overrun
-                spkr.beep(1000,0.25);
-            }
-            if (++writePointer >= maxBufLen) {
-                writePointer = 0;
-                led3 = !led3;
+                spkr.beep(500,0.25);
             }
         }
     }