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:
37:357e98a929cc
Parent:
36:966a86937e17
Child:
38:83d06c294807
diff -r 966a86937e17 -r 357e98a929cc main.cpp
--- a/main.cpp	Wed Dec 20 23:21:15 2017 +0000
+++ b/main.cpp	Thu Dec 21 16:07:47 2017 +0000
@@ -69,6 +69,11 @@
         - Modified code to log every 1 second in current iteration
     Modified 2017-12-20 revB by Troy
         - Fixed bug where Dive depth was resetting to rise depth
+    Modified 2017-12-21 revA by Troy
+        - 2 minute timeout default
+        - add system time to MBED logger
+        - Fixed bug where it was recording random keyboard presses (other FSM states)
+        - WORK IN PROGRESS to fix the batt and BCE PID saving
 */
  
 #include "mbed.h"
@@ -178,15 +183,16 @@
             
             //pc().printf("led 3 blinking once a second?\n\r"); //confirmed
             
-            //when the state machine is not in SIT_IDLE state
+            //when the state machine is not in SIT_IDLE state (or a random keyboard press)
+//            if(current_state != 0 or current_state != -1) {
             if(current_state != 0) {
                 //pc().printf("\n\rDEBUG: trying to record data \n\r");    
 
-               //if file is not open, open it
+               //if the log file is not open, open it
                 if (!file_opened) { 
                     mbedLogger().openFile();    //open MBED file once                    
                     file_opened = true;         //stops it from continuing to open it
-                    
+
                     pc().printf(">>>>>>>> Recording. Log file opened. <<<<<<<<\n\r");
                 }
                 
@@ -194,7 +200,6 @@
                OpenLog().recordData(current_state);   //start recording   
                 
                 //record to Mbed
-                //mbedLogger().saveDataToFile(string_state,current_state,stateMachine().dataArray());
                 mbedLogger().saveDataToFile(current_state,stateMachine().dataArray());                
             }
             
@@ -204,9 +209,9 @@
                 if (file_opened) {
                     mbedLogger().closeFile();
                     file_opened = false;
+                    
+                    pc().printf(">>>>>>>> Stopped recording. Log file closed. <<<<<<<<\n\r");
                 }
-                //else
-//                    file_opened = false;
             }
             
             log_loop = false;   // wait until the loop rate timer fires again