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:
74:d281aaef9766
Parent:
73:f6f378311c8d
Child:
82:0981b9ada820
--- a/SequenceController/SequenceController.cpp	Mon Jul 30 16:48:48 2018 +0000
+++ b/SequenceController/SequenceController.cpp	Tue Aug 14 21:06:48 2018 +0000
@@ -2,20 +2,18 @@
 #include "StaticDefs.hpp"
 
 SequenceController::SequenceController() {
-    pc().baud(57600);   //text was garbled before setting this
-    
     _sequence_counter = 0;
 }
 
 void SequenceController::loadSequence() {
-    pc().printf("\n\rLoading Dive Sequence File:");
+    xbee().printf("\n\rLoading Dive Sequence File:");
     
     ConfigFile read_sequence_cfg;
     char value[256];   
     
     //read configuration file stored on MBED
     if (!read_sequence_cfg.read("/local/sequence.txt")) {
-        pc().printf("\n\rERROR:Failure to read sequence.txt file.");
+        xbee().printf("\n\rERROR:Failure to read sequence.txt file.");
     }
     else {        
         /* Read values from the file until you reach an "exit" character" */
@@ -27,7 +25,7 @@
             /* convert INT to string */
         
             if (read_sequence_cfg.getValue(buf, &value[0], sizeof(value))) {
-                pc().printf("\n\rsequence %d = %s",i,value);
+                xbee().printf("\n\rsequence %d = %s",i,value);
                 
                 sequenceStructLoaded[i] = process(value); //create the structs using process(string randomstring)
             }
@@ -60,7 +58,7 @@
     /* PITCH */
     if ((signed int) randomstring.find("neutral") != -1) {
         loadStruct.title = "neutral";
-        pc().printf("\n\rLOAD neutral. %d", randomstring.find("neutral"));
+        xbee().printf("\n\rLOAD neutral. %d", randomstring.find("neutral"));
         loadStruct.state = FIND_NEUTRAL;
     }
     /* PITCH */
@@ -68,7 +66,7 @@
     /* EXIT */
     if ((signed int) randomstring.find("exit") != -1) {
         loadStruct.title = "exit";
-        pc().printf("\n\rReminder. Exit command is state FLOAT_BROADCAST\n\r");
+        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)
     }
     /* EXIT */
@@ -128,14 +126,14 @@
         char time_array[256] = {0};
         int time_counter = 0;
         for (int i = time_pos; i < randomstring.length(); i++) {
-            //pc().printf("time string cstr[i] = %c\n\r", cstr[i]); //debug
+            //xbee().printf("time string cstr[i] = %c\n\r", cstr[i]); //debug
             
             if (cstr[i] == ',') 
                 break;
             else if (cstr[i] == ';') 
                 break;
             else {
-                //pc().printf("time string cstr[i] = %c\n\r", cstr[i]); //debug
+                //xbee().printf("time string cstr[i] = %c\n\r", cstr[i]); //debug
                 time_array[time_counter] = cstr[i]; 
                 time_counter++;
             }
@@ -147,7 +145,7 @@
 //    /* EXIT */
 //    if (randomstring.find("exit") != 0) {
 //        loadStruct.title = "exit";
-//        pc().printf("\n\rEXIT.");
+//        xbee().printf("\n\rEXIT.");
 //    }
 //    /* EXIT */
     
@@ -155,10 +153,10 @@
 }
 
 void SequenceController::sequenceFunction() {
-    //pc().printf("sequenceFunction\n\r");    //debug (verified it is working correctly)
+    //xbee().printf("sequenceFunction\n\r");    //debug (verified it is working correctly)
     
     int check_current_state = stateMachine().getState();
-    pc().printf("State Machine State: %d\n\r", check_current_state);
+    xbee().printf("State Machine State: %d\n\r", check_current_state);
         
     if (stateMachine().getState() == SIT_IDLE) {
         //system starts idle
@@ -166,9 +164,9 @@
         //example, set to "dive" and set pitch and depth and timeout
         
         _current_state = sequenceStructLoaded[_sequence_counter].state;
-        pc().printf("_current_state: %d\n\r", _current_state);
-        pc().printf("_sequence_counter: %d\n\r", _sequence_counter);
-        pc().printf("_number_of_sequences: %d\n\r", _number_of_sequences);
+        xbee().printf("_current_state: %d\n\r", _current_state);
+        xbee().printf("_sequence_counter: %d\n\r", _sequence_counter);
+        xbee().printf("_number_of_sequences: %d\n\r", _number_of_sequences);
         
         stateMachine().setState(_current_state);
         stateMachine().setDepthCommand(sequenceStructLoaded[_sequence_counter].depth);