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:
3:e1a884e5325a
diff -r 8e24e633f8d8 -r 7039be3daf6e main.cpp
--- a/main.cpp	Tue Apr 30 19:59:43 2013 +0000
+++ b/main.cpp	Fri May 03 19:27:56 2013 +0000
@@ -26,6 +26,7 @@
 Serial toPC(USBTX, USBRX);      //connect the GPS TX, RX to p9 and p10
 
 Timer timeFromStart;
+Timer timeFromPosVelMessageReceipt;
 
 bool detectedGPS1PPS = false;       //flag set in the ISR and reset after processing the 1PPS event
 int PPSCounter = 0;                 //counts the 1PPS occurrences
@@ -232,6 +233,15 @@
         //read the USB serial data from the PC to check for commands
         //in the primary real-time portion, there are no bytes from the PC so this has no impact
         readFromPC();
+        
+        //this will close the fpNav file on the SD card if the file is open 
+        //and the elapsed time from PosVel messages is > 60 secs
+        //this prevents loosing the fpNav file if the PC goes down
+        if (fpNav && (timeFromPosVelMessageReceipt.read() < 60) )
+        {
+            sendRecData = true;
+            recordData  = false;
+        }
                 
         processPCmessages(fpNav, posMsg, velMsg);
         
@@ -241,7 +251,7 @@
             pre_fire = 0;  //pin30 (midbody of connector) set to zero
             wait(.01f);  //wait for 0.25 secs
             fire = 0; //fire the trigger using the tip connection
-            wait(1.0);
+            wait(0.10);
             fire = 1;
             pre_fire = 1;
             unsigned long triggerTime = GPSTimemsecs + PPSTimeOffset*1000 + timeFromPPS.read_us()/1000.0;