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:
65:2ac186553959
Parent:
64:a8939bc127ab
Child:
66:0f20870117b7
--- a/StateMachine/StateMachine.cpp	Mon Jun 18 21:04:09 2018 +0000
+++ b/StateMachine/StateMachine.cpp	Tue Jun 19 18:10:50 2018 +0000
@@ -871,7 +871,7 @@
 
 void StateMachine::showDebugMenu() {
     pc().printf("\r\r\n\nDEBUG KEYBOARD MENU (06/15/2018):\r\r\n");
-    pc().printf(" T to go into CHECK NEUTRAL TUNING (This is on a timer! Uses NEUTRAL positions!)\r\n");
+    pc().printf(" Y to go into CHECK NEUTRAL TUNING (This is on a timer! Uses NEUTRAL positions!)\r\n");
     pc().printf(" V to POSITION DIVE (initiate motor position-based dive cycle)\r\n");
     pc().printf(" N to find neutral\r\n");
     pc().printf(" M to initiate multi-dive cycle\r\n");
@@ -894,7 +894,7 @@
     pc().printf("9/0 to decrease/increase heading setpoint: %0.1f deg\r\n",_heading_command);
     pc().printf("k/l to decrease/increase BCE offset: %3.1f (Dive POS: %0.1f, Rise POS: %0.1f)\r\n",_BCE_dive_offset, _neutral_bce_pos_mm - _BCE_dive_offset, _neutral_bce_pos_mm + _BCE_dive_offset);
     pc().printf(";/' to decrease/increase BMM offset: %3.1f (Dive POS: %0.1f, Rise POS: %0.1f)\r\n",_BMM_dive_offset, _neutral_batt_pos_mm - _BMM_dive_offset, _neutral_batt_pos_mm + _BMM_dive_offset);  
-    pc().printf("-/+ to decrease/increase timeout: %d s\r\n",_timeout);
+    pc().printf("T to enter in the timeout (default is 60 seconds): %d s\r\n",_timeout);
     
 // FIXED WITH NEW CODE
     pc().printf(" 1 BCE PID sub-menu\r\n");
@@ -1143,6 +1143,11 @@
 /***************************** DEBUG MENU *****************************/             
         if (_debug_menu_on) {
             
+            if (user_input == 'T') {
+                pc().printf("Please enter the timeout (timer) value below: \n\r");
+                _timeout = fabs(getFloatUserInput());
+            }
+            
             if (user_input == 'D') {
                 _keyboard_state = DIVE;
             }
@@ -1173,7 +1178,7 @@
                 _keyboard_state = EMERGENCY_CLIMB;
             }
             
-            else if (user_input == 'T') {
+            else if (user_input == 'Y') {
                 _keyboard_state = CHECK_TUNING;
             }
             
@@ -1309,16 +1314,7 @@
                 _depth_command += 0.5;         //increment the depth setpoint
                 depthLoop().setCommand(_depth_command);
                 pc().printf(">>> new depth setpoint: %0.3f ft (rise)\r\n", depthLoop().getCommand());
-            }
-            else if (user_input == '-') {
-                _timeout -= 10.0;               //decrement the timeout
-                pc().printf(">>> timeout decreased: %d\r\n", _timeout);
-            }
-            else if (user_input == '=' or user_input == '+') {
-                _timeout += 10.0;               //increment the timeout
-                pc().printf(">>> timeout increased: %d\r\n", _timeout);
-            }
-            
+            }            
             else if (user_input == '5') {
                 keyboard_menu_RUDDER_SERVO_settings();
             }
@@ -1350,7 +1346,7 @@
                 headingLoop().setCommand(_heading_command);
                 pc().printf(">>> (+) new HEADING setpoint: %0.3f deg (+)\r\n", headingLoop().getCommand());
             }
-            else if (user_input == 'Y') {
+            else if (user_input == 'U') {
                 keyboard_menu_POSITION_READINGS();
             }
             
@@ -1439,7 +1435,11 @@
 /***************************** DEBUG MENU *****************************/
             
 /***************************** SIMPLE MENU *****************************/
-        else {       
+        else {
+            if (user_input == 'T') {
+                pc().printf("Please enter the timeout (timer) value below: \n\r");
+                _timeout = fabs(getFloatUserInput());
+            }      
             if (user_input == 'V') {
                 _keyboard_state = POSITION_DIVE;
             }
@@ -1512,16 +1512,7 @@
                 pc().printf("depth  P:%6.2f, I:%6.2f, D:%6.2f, offset:%6.1f mm \r\n", depthLoop().getControllerP(), depthLoop().getControllerI(), depthLoop().getControllerD(), depthLoop().getOutputOffset());
                 pc().printf("pitch  P:%6.2f, I:%6.2f, D:%6.2f, offset:%6.1f mm \r\n", pitchLoop().getControllerP(), pitchLoop().getControllerI(), pitchLoop().getControllerD(), pitchLoop().getOutputOffset());
             }
-            
-            else if (user_input == '-') {
-                _timeout -= 10.0;               //decrement the timeout
-                pc().printf(">>> timeout decreased: %d\r\n", _timeout);
-            }
-            else if (user_input == '=' or user_input == '+') {
-                _timeout += 10.0;               //increment the timeout
-                pc().printf(">>> timeout increased: %d\r\n", _timeout);
-            }
-            
+                        
             else if (user_input == '?') {
                 pc().printf("\n\n\n>>> Resetting MBED <<<\n\n\n");
                 wait(0.5);
@@ -1592,7 +1583,7 @@
             wait(1);         
             
             
-            pc().printf("BCE POS (CMD): %0.1f (%0.1f) BATT POS: %0.1f (%0.1f) PRESS_psi: %0.2f [depth_ft: %0.2f], PITCH: %0.2f, HEADING: %0.2f, rudder_servo_pwm: %0.1f [0(%d),1(%d),2(%d),6(%d),4(%d),5(%d),6(%d),7(%d)]\r",bce().getPosition_mm(), bce().getSetPosition_mm(),batt().getPosition_mm(), batt().getSetPosition_mm(),depth().getPsi(),depthLoop().getPosition(),imu().getPitch(),imu().getHeading(),rudder().getPosition_pwm(),adc().readCh0(),adc().readCh1(),adc().readCh2(),adc().readCh3(),adc().readCh4(),adc().readCh5(),adc().readCh6(),adc().readCh7());
+            pc().printf("BCE POS (CMD): %0.1f (%0.1f) BATT POS: %0.1f (%0.1f) PRESS_psi: %0.2f [depth_ft: %0.2f], PITCH: %0.2f, HEADING: %0.2f, rudder_servo_pwm: %0.1f [0(%d),1(%d),2(%d),6(%d),4(%d),5(%d),6(%d),7(%d)] Switch: BCE(%d) BMM(%d)\r",bce().getPosition_mm(), bce().getSetPosition_mm(),batt().getPosition_mm(), batt().getSetPosition_mm(),depth().getPsi(),depthLoop().getPosition(),imu().getPitch(),imu().getHeading(),rudder().getPosition_pwm(),adc().readCh0(),adc().readCh1(),adc().readCh2(),adc().readCh3(),adc().readCh4(),adc().readCh5(),adc().readCh6(),adc().readCh7(), bce().getHardwareSwitchStatus(),batt().getHardwareSwitchStatus());
             //pc().printf("BCE POS (CMD): %0.1f (%0.1f) BATT POS: %0.1f (%0.1f) PRESS_psi: %0.2f (unfiltered: %0.2f) [depth_ft: %0.2f], PITCH: %0.2f, HEADING: %0.2f, rudder_servo_pwm: %0.1f\r",bce().getPosition_mm(), bce().getSetPosition_mm(),batt().getPosition_mm(), batt().getSetPosition_mm(),depth().getPsi(),depth().getRawPSI(),depthLoop().getPosition(),imu().getPitch(),imu().getHeading(),rudder().getPosition_pwm());
             //pc().printf("\n0(%d),1(%d),2(%d),6(%d),4(%d),5(%d),6(%d),7(%d)\r\n",adc().readCh0(),adc().readCh1(),adc().readCh2(),adc().readCh3(),adc().readCh4(),adc().readCh5(),adc().readCh6(),adc().readCh7());