JEK changes enabling proper recording of IMU/GPS datastrams - 02-APR-2013
Fork of GPS_Incremental by
Diff: PCMessaging.h
- Revision:
- 7:2e20e4cf53e6
- Parent:
- 6:2a8486283198
- Child:
- 8:13724ed3f825
--- a/PCMessaging.h Tue Apr 02 15:22:37 2013 +0000 +++ b/PCMessaging.h Sat Apr 06 21:24:52 2013 +0000 @@ -1,7 +1,7 @@ //these are defines for the messages that are sent from the PC across the USB //these messages produce reactions on the mbed -const unsigned char STATUS_MSG =0; -const unsigned char POSVEL_MSG =1; +const unsigned char STATUS_MSG =0; +const unsigned char POSVEL_MSG =1; const unsigned char STARTDATA_MSG =2; const unsigned char STOPDATA_MSG =3; const unsigned char STARTSTREAM_MSG =4; @@ -29,7 +29,7 @@ const unsigned char numMessages = 8; //number of potential messages char msgList[numMessages][32]; //text array storing the command messages from the PC -char minMessageSize = 10; //minimum size of a text message +char minMessageSize = 11; //minimum size of a text message unsigned char CR = 0x0d; //ASCII Carriage Return unsigned char LF = 0x0a; //ASCII Line Feed @@ -58,21 +58,23 @@ // Read in next character char inChar = toPC.getc(); //read char from the USB serial link to the PC + //toPC.printf("%02x ",inChar); //incoming messages will end witb a CR / LF -- disregard these chars - if (inChar == CR || inChar == LF) return; + if (inChar == CR || inChar == LF) return; //CR is a 0x0a serBuf[serBufChars++] = inChar; //set this char in a char array //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 serBuf[serBufChars] = '\0'; bool validMessage = false; + // Check for valid message -- there are numMessages possible messages for (int m = 0; m < numMessages && !validMessage; m++) //check for all messages ... { @@ -83,7 +85,7 @@ if (serBufChars == strlen(msgList[m]) && strncmp(serBuf, msgList[m], serBufChars) == 0 ) { - //toPC.printf( "\n found valid message \n\n"); + //toPC.printf( "\n found valid message %s \n\n", serBuf); validMessage = true; serBufChars = 0; //reset the character count to reset for next message @@ -185,10 +187,17 @@ double lonPos = posMsg.longitude + (eVel/lonRateFac)*elTime; double htPos = posMsg.height + velMsg.verticalSpeed/(60*1852)*elTime; - toPC.printf("WMsg POSVEL %5.3lf %1d %s %8.5lf %9.5lf %4.3lf %4.3lf %4.3lf %4.3lf\n", + char solReady = 'N'; + //solStatus + if (posMsg.solStatus == 0) //see description of solution status in OEMV615.h + { + solReady = 'Y'; + } + + toPC.printf("WMsg POSVEL %5.3lf %1d %c %8.5lf %9.5lf %4.3lf %4.3lf %4.3lf %4.3lf\n", posTime, posMsg.numSolSV, - posMsg.solStatus, + solReady, latPos, lonPos, htPos,