this version has all of Jim's fixes for reading the GPS and IMU data synchronously
Dependencies: MODSERIAL SDFileSystem mbed SDShell CRC CommHandler FP LinkedList LogUtil
Diff: PCMessaging.h
- Revision:
- 5:2ce1be9d4bef
- Parent:
- 2:7039be3daf6e
- Child:
- 6:71da5b99de97
--- a/PCMessaging.h Sat May 04 23:16:16 2013 +0000 +++ b/PCMessaging.h Sat May 04 23:43:53 2013 +0000 @@ -68,14 +68,16 @@ //incoming messages will end witb a CR / LF -- disregard these chars if (inChar == CR || inChar == LF) return; //CR is a 0x0a - serBuf[serBufChars++] = inChar; //set this char in a char array + // serBuffMax = 1024 -- largest serBuffMax is 1023 -- but we add one below for the '\0' + if (serBufChars >= (serBuffMax-2)) {toPC.printf("WMsg overun char buff \n"); serBufChars = 0; }; + serBuf[serBufChars] = inChar; //set this char in a char array + serBufChars++; //no need to continue if numChars are less than the shortest candidate message - //if (serBufChars < minMessageSize) return; + if (serBufChars < minMessageSize) return; // Append end of string //We always assume we have a complete message string and test for this below - if (serBufChars >= serBuffMax) {toPC.printf(" overun char buff \n"); serBufChars = 0; return; }; serBuf[serBufChars] = '\0'; bool validMessage = false;