modifications to run via legfile.txt and then exit, manage logfile versions, diagnostics file

Dependencies:   mbed MODSERIAL FATFileSystem

Revision:
16:3363b9f14913
Child:
17:7c16b5671d0e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/StateMachine/StateMachine.hpp	Mon Nov 06 22:57:56 2017 +0000
@@ -0,0 +1,52 @@
+#ifndef STATEMACHINE_HPP
+#define STATEMACHINE_HPP
+
+#include "mbed.h"
+//#include "StaticDefs.hpp"
+
+extern "C" void mbed_reset();           // utilized to reset the mbed
+
+// state enumerations
+enum {
+    SIT_IDLE,           // stops both motors, exits after a keyboard input
+    KEYBOARD,           // handles an individual keypress, exits to state by a keyboard menu
+    FIND_NEUTRAL,       // dives to depth at zero pitch, exits when stable
+    DIVE,               // dives to depth at negative pitch, exits when crossing a defined depth
+    RISE,               // rises to surface at positive pitch, exits when near surface
+    FLOAT_LEVEL,        // bce position to float, pitch loop active at zero, exits when stable near zero pitch
+    FLOAT_BROADCAST,    // bce position to float, batt position forward to hold tail up, exits when actuators done
+    EMERGENCY_CLIMB     // bce position to full rise, batt position to full aft, exits when at surface
+};
+
+class StateMachine {
+public:
+    StateMachine();
+    
+    void runStateMachine();
+    
+    void showMenu();
+    
+    int keyboard();
+    
+    void keyboard_menu_BCE_PID_settings();
+    void keyboard_menu_BATT_PID_settings();
+    void keyboard_menu_DEPTH_PID_settings();
+    void keyboard_menu_PITCH_PID_settings();
+    
+    float getDepthCommand();
+    float getPitchCommand();
+    
+private:
+    int timeout;                // generic timeout for every state, seconds
+    float depthTolerance;       // depth tolerance for neutral finding exit critera
+    float pitchTolerance;       // pitch angle tolerance for neutral finding exit criteria
+    float bceFloatPosition;     // bce position for "float" states
+    float battFloatPosition;    // batt position for "broadcast" state
+    
+    float depthCommand;         // user keyboard depth
+    float pitchCommand;         // user keyboard depth
+    
+    Timer timer;
+};
+
+#endif
\ No newline at end of file