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

Files at this revision

API Documentation at this revision

Comitter:
jekain314
Date:
Thu May 09 16:06:45 2013 +0000
Parent:
16:2aea22130ba1
Child:
18:111025f447d8
Commit message:
added attempts to shut down and restart smoothly

Changed in this revision

PCMessaging.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/PCMessaging.h	Wed May 08 06:22:57 2013 +0000
+++ b/PCMessaging.h	Thu May 09 16:06:45 2013 +0000
@@ -40,6 +40,8 @@
 
 char preamble[5] = "WMsg";
 char testPreamble[5];
+bool validMessage = false;
+
 
 void setUpMessages(void)
 { 
@@ -105,7 +107,7 @@
         // We always assume we have a complete message string and test for this below
         serBuf[serBufChars] = '\0';
         
-        bool validMessage = false;
+        validMessage = false;
         
         // Check for valid message -- there are numMessages possible messages
         //this assumes that the message buffer contains an exact message
--- a/main.cpp	Wed May 08 06:22:57 2013 +0000
+++ b/main.cpp	Thu May 09 16:06:45 2013 +0000
@@ -61,11 +61,14 @@
     ADIS_RST = 0;       // same here
     wait(0.01f);        // just make sure that the hardware has time to stop
     trig1led = ppsled = rxMsg = txMsg = 1;  // just indicate that we're in here
-    toPC.attach(NULL);  // incase the PC serial was using an interrupt handler for RX
+    //toPC.attach(NULL);  // incase the PC serial was using an interrupt handler for RX
     fflush(stdout);     // and clear any TX reminants
     toPC.printf("Entering Shell Emulator...\n");    // just for fluf
     wait(0.1f);         // no reason for this either
     emulate.shell(toPC, sd, "/sd"); // now the SDShell object will serve SD files via UNIX commands
+    
+    toPC.printf(" normal termination of single mission \n");
+    wait(0.1f);
 }
 
 //ISR for detection of the GPS 1PPS
@@ -246,10 +249,13 @@
     Timer triggerInterval;
     
     //while(PPSCounter < 300)
+    
+    bool newMission = true;
+    
     ///////////////////////////////////////////////////////////////////////////
-    // top of the while loop
+    // top of the mission while loop
     ///////////////////////////////////////////////////////////////////////////
-    while(1)
+    while(newMission)
     {        
             
         //read the USB serial data from the PC to check for commands
@@ -402,16 +408,15 @@
         }
     }
       
-    if (fpNav != NULL) fclose(fpNav);  //insurance
-    transferFile();
-    // to exit this function the HOST (ie: computer or PC app) must send "exit" otherwise the mbed will act
-    // like a terminal and serve SD file data forever
+
+     if (fpNav != NULL) fclose(fpNav);  //insurance
+     transferFile();
+     // to exit this function the HOST (ie: computer or PC app) must send "exit" otherwise the mbed will act
+     // like a terminal and serve SD file data forever
     
-    
-    
-    
-    
-    toPC.printf(" normal termination \n");
+     toPC.printf(" normal termination of single mission \n");
+     
+     NVIC_SystemReset();
     
     /*
     //at this point we have terminated the dat collection and we need to send the stored nav file to the PC