most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown

Dependencies:   mbed MODSERIAL FATFileSystem

Revision:
86:ba3a118b0080
Parent:
85:dd8176285b6e
Child:
87:6d95f853dab3
--- a/SequenceController/SequenceController.cpp	Mon Feb 25 21:26:34 2019 +0000
+++ b/SequenceController/SequenceController.cpp	Thu May 02 20:34:16 2019 +0000
@@ -9,7 +9,8 @@
     xbee().printf("\n\rLoading Dive Sequence File:");
     
     ConfigFile read_sequence_cfg;
-    char value[256];   
+    char value[256];
+    char bux2[256];   
     
     //read configuration file stored on MBED
     if (!read_sequence_cfg.read("/local/sequence.txt")) {
@@ -32,6 +33,8 @@
             
             if (sequenceStructLoaded[i].title == "exit") {
                 _number_of_sequences = i;   //before the exit
+                sprintf(bux2,"\n\rin loadsequence(): found final exit line num-sequences=%d\n", i);
+                   mbedLogger().appendDiagFile(bux2,0);
                 break;
             }
         }
@@ -40,7 +43,7 @@
 
 sequenceStruct SequenceController::process(string randomstring) {
     //this is the struct that is loaded from the config variables
-    
+    char bux2[256];
     sequenceStruct loadStruct; //local struct
     
     /* CONVERT STRING TO CHAR ARRAY */
@@ -60,6 +63,8 @@
         loadStruct.title = "neutral";
         xbee().printf("\n\rLOAD neutral. %d", randomstring.find("neutral"));
         loadStruct.state = FIND_NEUTRAL;
+         sprintf(bux2,"\n\rin sequence().process(string): FOUND NEUTRAL in randomstring.find \n");
+                   mbedLogger().appendDiagFile(bux2,3);
     }
     /* PITCH */
     
@@ -67,6 +72,8 @@
     if ((signed int) randomstring.find("exit") != -1) {
         loadStruct.title = "exit";
         xbee().printf("\n\rReminder. Exit command is state FLOAT_BROADCAST\n\r");
+        sprintf(bux2,"\n\rin sequence().process(string): FOUND EXIT in randomstring.find \n");
+                   mbedLogger().appendDiagFile(bux2,0);
         loadStruct.state = FLOAT_BROADCAST; //this is the new exit condition of the dive-rise sequence (11/4/17)
     }
     /* EXIT */
@@ -78,12 +85,12 @@
             char depth_array[256] = {0};    //clear memory
             int depth_counter = 0;
             for (int i = depth_pos; i < randomstring.length(); i++) {
-                if (cstr[i] == ',') 
+                if (cstr[i] == ',')
                     break;
-                else if (cstr[i] == ';') 
+                else if (cstr[i] == ';')
                     break;
                 else {
-                    depth_array[depth_counter] = cstr[i]; 
+                    depth_array[depth_counter] = cstr[i];
                     depth_counter++;
                 }
             }
@@ -207,7 +214,7 @@
     if (!read_leg_cfg.read("/local/legfile.txt")) {  //legfile.txt has exact same format as sequence.txt file,with starting 0=leg,.... and ending 1=exit line
         xbee().printf("\n\rERROR:Failure to read legfile.txt file.");
         sprintf(bux2,"\n\rERROR:Failure to read legfile.txt file.");
-        //mbedLogger().appendDiagFile(bux2,0);
+        mbedLogger().appendDiagFile(bux2,3);
         
     }
     else {        
@@ -254,7 +261,7 @@
     //this is the struct that is loaded from the config variables
     
     legStruct loadStruct; //local struct
-    
+    static int callcount=0;
     /* CONVERT STRING TO CHAR ARRAY */
     const char *cstr = randomstring.c_str();
     char bux2[256];
@@ -262,6 +269,8 @@
     
     /* leg position DIVing */
     //this can only be in the first position
+    
+    callcount++;
     if ((signed int) randomstring.find("leg") != -1) {
         loadStruct.title = "leg";
         loadStruct.state = LEG_POSITION_DIVE;      //NEW: separate state handles multiple dives
@@ -283,7 +292,7 @@
         loadStruct.title = "exit";
         xbee().printf("\n\rReminder. Exit command is state FLOAT_BROADCAST\n\r");
         loadStruct.state = FLOAT_BROADCAST; //this is the new exit condition of the dive-rise sequence (11/4/17)
-                sprintf(bux2, "\n\r process legfile: found exit key \n");
+                sprintf(bux2, "\n\r process legfile: found exit key callcount=%d\n", callcount);
                 mbedLogger().appendDiagFile(bux2,3);
     }
     /* EXIT */
@@ -306,7 +315,7 @@
                 }
             }
             loadStruct.max_depth = atof(depth_array);
-                sprintf(bux2, "\n\r process legfile: key=max_depth val=%g \n", atof(depth_array));
+                sprintf(bux2, "\n\r process legfile: key=max_depth val=%g  process(legstring)count=%d \n", atof(depth_array), callcount);
                 mbedLogger().appendDiagFile(bux2,3);
         }
     }