Changes to allow hardware camera trigger

Dependencies:   mbed

Fork of GPS_Incremental by james kain

Revision:
10:078891935385
Parent:
9:13724ed3f825
--- a/PCMessaging.h	Wed Apr 17 13:50:21 2013 +0000
+++ b/PCMessaging.h	Thu Apr 18 00:59:49 2013 +0000
@@ -8,6 +8,7 @@
 const unsigned char  STOPSTREAM_MSG     =5;
 const unsigned char  STARTLOGINFO_MSG   =6;
 const unsigned char  STOPLOGINFO_MSG    =7;
+const unsigned char  SEND_TRIG          =8;
 
 const double  DEGREES_TO_RADIANS = acos(-1.0)/180.0;
 const double eccen          = 0.0818191908426;  //WGS84 earth eccentricity
@@ -25,9 +26,10 @@
 bool logMsgInfo     =false;
 bool sendLogMsgInfo =false;
 bool recordData     =false;
+bool camtrg         =false;
 
 
-const unsigned char numMessages = 8;    //number of potential messages
+const unsigned char numMessages = 9;    //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
@@ -44,6 +46,7 @@
     sprintf(msgList[STOPSTREAM_MSG],    "WMsg POSSTREAM N");
     sprintf(msgList[STARTLOGINFO_MSG],  "WMsg LOGINFO Y");
     sprintf(msgList[STOPLOGINFO_MSG],   "WMsg LOGINFO N");
+    sprintf(msgList[SEND_TRIG],         "WMsg SEND_TRIG");
     //message length is from 10 to 16 chars
     
     toPC.printf(" finished setting up messages \n");
@@ -116,7 +119,10 @@
                     case STOPLOGINFO_MSG:
                         logMsgInfo = (m == STARTLOGINFO_MSG);
                         sendLogMsgInfo = true;
-                    break;  
+                    break;
+                    case SEND_TRIG:
+                        camtrg = true;  //send a posvel message back to PC
+                    break; 
                 }  //end Switch statement
                 break;
             } //end test for a valid message
@@ -213,6 +219,12 @@
         //we should put the below stuff into the readPC() procedure.
         //only do these actions in response to a command so no need for the tests w/o an inoput byte from the PC
         //perform the activities as a response to the commands
+        
+        if (camtrg)  //true if camera trigger command sent from PC
+        {
+            camera1EventDetected=true;
+            
+        }
         if (sendPosVel)  //true if we want to return a position solution
         {
             sendPosVel=false; //set to true if a POSVEL is requested from the PC