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:
sam_grove
Date:
Mon May 06 01:37:38 2013 +0000
Parent:
6:71da5b99de97
Child:
8:11ce2bdd3bbd
Commit message:
made changes to PCMessage and main for the log tx'fer

Changed in this revision

PCMessaging.h Show annotated file Show diff for this revision Revisions of this file
SDShell.lib 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	Sun May 05 14:35:25 2013 +0000
+++ b/PCMessaging.h	Mon May 06 01:37:38 2013 +0000
@@ -9,6 +9,7 @@
 const unsigned char  STOPSTREAM_MSG     =6;
 const unsigned char  STARTLOGINFO_MSG   =7;
 const unsigned char  STOPLOGINFO_MSG    =8;
+const unsigned char  GETFILE_MSG        =9;
 
 const double  DEGREES_TO_RADIANS = acos(-1.0)/180.0;
 const double eccen          = 0.0818191908426;  //WGS84 earth eccentricity
@@ -28,9 +29,10 @@
 bool sendLogMsgInfo =false;
 bool recordData     =false;
 bool fireTrigger    =false;
+bool get_file_msg   =false;
 
 
-const unsigned char numMessages = 9;    //number of potential messages
+const unsigned char numMessages = 10;    //number of potential messages
 char msgList[numMessages][32];          //text array storing the command messages from the PC
 char minMessageSize = 11;               //minimum size of a text message
 unsigned char CR = 0x0d;                //ASCII Carriage Return
@@ -51,6 +53,7 @@
     sprintf(msgList[STARTLOGINFO_MSG],  "WMsg LOGINFO Y");
     sprintf(msgList[STOPLOGINFO_MSG],   "WMsg LOGINFO N");
     sprintf(msgList[FIRE_TRIGGER_MSG],  "WMsg TRIGGER");
+    sprintf(msgList[GETFILE_MSG],       "WMsg GETFILE");
     //message length is from 10 to 16 chars
     
  //   toPC.printf(" finished setting up messages \n");
@@ -126,33 +129,44 @@
                 {
                     case STATUS_MSG:
                         sendStatus = true;  //send a status message back to PC
-                    break;
+                        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;
+                        break;
+                    
                     case STARTDATA_MSG:  //start the data recording to the SD card
                         recordData = true;
                         sendRecData = true;
                         break;
+                    
                     case STOPDATA_MSG:   //stop the data recording to the SD card
                         recordData = false;
                         sendRecData = true;
                         break;
+                    
                     case STARTSTREAM_MSG:
                     case STOPSTREAM_MSG:
                         streamPos = (m == STARTSTREAM_MSG);
                         sendStreamPos = true;
-                    break;
+                        break;
+                    
                     case STARTLOGINFO_MSG:
                     case STOPLOGINFO_MSG:
                         logMsgInfo = (m == STARTLOGINFO_MSG);
                         sendLogMsgInfo = true;
-                    break;  
+                        break;  
+                    
                     case FIRE_TRIGGER_MSG:
                         fireTrigger = true;
                         toPC.printf("MBED received trigger command \n");
-                    break;
+                        break;
+                    
+                    case GETFILE_MSG:
+                        get_file_msg = true;
+                        break;
+                    
                 }  //end Switch statement
                 break;
             } //end test for a valid message
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDShell.lib	Mon May 06 01:37:38 2013 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/sam_grove/code/SDShell/#6ff0a3d92778
--- a/main.cpp	Sun May 05 14:35:25 2013 +0000
+++ b/main.cpp	Mon May 06 01:37:38 2013 +0000
@@ -43,6 +43,15 @@
 
 volatile int PPSTimeOffset = 0;
 
+// get files from the SD Card
+#include "SDShell.h"
+void transferFile(void)
+{
+    SDShell emulate;
+    emulate.init();
+    emulate.shell(toPC, sd, "/sd");
+}
+
 //////////////////////////////////////////////////////////////////////
 // the below should become classes
 //////////////////////////////////////////////////////////////////////
@@ -378,6 +387,16 @@
             IMURecordCounter = 0;
             detectedGPS1PPS = false;
         }
+        
+        if(get_file_msg)
+        {
+            get_file_msg = false;
+            ADIS_RST = 0;
+            GPS_Reset = 0;
+            fclose(fpNav);
+            transferFile();
+            
+        }
     }
       
     fclose(fpNav);