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:
80:4e5d306d695b
Parent:
76:c802e1da4179
Child:
82:0981b9ada820
--- a/StateMachine/StateMachine.cpp	Tue Oct 23 20:35:16 2018 +0000
+++ b/StateMachine/StateMachine.cpp	Wed Oct 24 16:07:10 2018 +0000
@@ -1098,6 +1098,14 @@
             _timeout = fabs(getFloatUserInput());
         }
         
+        else if (user_input == '~') {
+            xbee().printf("MBED LOG FILE MENU!\r\n");
+            stateMachine().logFileMenu();
+                
+            //xbee().printf("ERASING MBED LOG FILE\r\n");   //legacy method
+            //mbedLogger().eraseFile();
+        }
+        
         else if (user_input == 'C' or user_input == 'c') {
                 
             xbee().printf("\r\n\nCURRENT STATUS AND PARAMETERS:\r\n");
@@ -1204,10 +1212,6 @@
             else if (user_input == 'X') {
                 mbedLogger().printMbedDirectory();        //print all log files to the screen
             }
-            else if (user_input == '~') {
-                xbee().printf("ERASING MBED LOG FILE\r\n"); 
-                mbedLogger().eraseFile();
-            }
             else if (user_input == 'Z') {
                 xbee().printf("FSG FSM States: \r\n");
                 string string_state;
@@ -1348,10 +1352,6 @@
                 //printCurrentSdLog();
                 mbedLogger().printCurrentLogFile();        //print the current log file to the screen
             }
-            else if (user_input == '~') {
-                xbee().printf("ERASING MBED LOG FILE\r\n"); 
-                mbedLogger().eraseFile();
-            }
             
 //POSITION DIVE COMMANDS
             else if (user_input == 'Q') {
@@ -2125,4 +2125,44 @@
 
 float StateMachine::getTimerValue() {
     return _fsm_timer;    
+}
+
+void StateMachine::logFileMenu() {    
+    char FILE_MENU_key;
+    
+    // print the menu
+    xbee().printf("\n\r>>> LOG FILE MENU. Y = Yes, erase file (and exit).  N = No, keep file (and exit).  P = Print file size.<<<\n\r");
+    
+    // handle the key presses
+    while(1) {
+        // get the user's keystroke from either of the two inputs
+        if (xbee().readable()) {
+            xbee().printf("\n\r>>> LOG FILE MENU. Y = Yes, erase file (and exit).  N = No, keep file (and exit).  P = Print file size.<<<\n\r");
+            FILE_MENU_key = xbee().getc();
+        }
+        else {
+            continue; // didn't get a user input, so keep waiting for it
+        }
+    
+        // handle the user's key input
+        if (FILE_MENU_key == 'P') { // user wants to save these modified values
+            xbee().printf("\n\r>> Printing log file size!\n\r");
+            wait(2);
+            mbedLogger().getFileSize("/local/LOG000.csv");
+        }
+        else if (FILE_MENU_key == 'Y') {
+            xbee().printf("\n\r>> Erasing MBED LOG FILE!\n\r");
+            wait(2);
+            mbedLogger().eraseFile();
+            break;
+        }
+        else if (FILE_MENU_key == 'N') {
+            xbee().printf("\n\r>> EXITING MENU. Log file intact.\n\r");
+            wait(2);
+            break;
+        }
+        else {
+            xbee().printf("\n\r[%c] This key does nothing here.                                  \r", FILE_MENU_key);
+        }
+    }
 }
\ No newline at end of file