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

Revision:
2:7039be3daf6e
Parent:
1:8e24e633f8d8
Child:
5:2ce1be9d4bef
--- a/PCMessaging.h	Tue Apr 30 19:59:43 2013 +0000
+++ b/PCMessaging.h	Fri May 03 19:27:56 2013 +0000
@@ -96,6 +96,7 @@
 
                 validMessage = true;
                 serBufChars = 0; //reset the character count to reset for next message
+                
     
                 //set programmatic action flags based on the message
                 switch(m)
@@ -105,6 +106,7 @@
                     break;
                     case POSVEL_MSG:
                         sendPosVel = true;  //send a posvel message back to PC
+                        timeFromPosVelMessageReceipt.reset();  //start time and close SD card file if too long
                     break;
                     case STARTDATA_MSG:  //start the data recording to the SD card
                         recordData = true;
@@ -228,6 +230,15 @@
         //perform the activities as a response to the commands
         if (sendPosVel)  //true if we want to return a position solution
         {
+            //if we are receiving POSVEL requests -- always open the file for storage and store the data
+            //th file is closed(in main) if we dont receive POSVAL messages for 60 secs
+            if (fpNav == NULL)
+            { 
+                toPC.printf(" opening the SD card file \n");
+                fpNav = fopen("/sd/Data/NAV.bin", "wb");
+                wait_ms(10);
+                recordData = true;
+            }
             sendPosVel=false; //set to true if a POSVEL is requested from the PC
             sendPosVelMessageToPC(posMsg, velMsg);
         }
@@ -261,7 +272,7 @@
                 {
                     toPC.printf(" opening the SD card file \n");
                     fpNav = fopen("/sd/Data/NAV.bin", "wb");
-                    wait_ms(1000);
+                    wait_ms(10);
                 }
                 if (fpNav != NULL)  //if the fie was already opened we will respond to the PC with a Y 
                 {