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
Diff: main.cpp
- Revision:
- 80:4e5d306d695b
- Parent:
- 79:3688c3a0d7f4
- Child:
- 81:7ff2c6467892
--- a/main.cpp Tue Oct 23 20:35:16 2018 +0000 +++ b/main.cpp Wed Oct 24 16:07:10 2018 +0000 @@ -7,8 +7,6 @@ volatile unsigned int bTick = 0; volatile unsigned int timer_counter = 0; -FILE *_sd_fp; //new 10/23/18 - static unsigned int read_ticker(void) { //Basically this makes sure you're reading the data at one instance (not while it's changing) unsigned int val = bTick; if( val ) @@ -16,10 +14,6 @@ return( val ); } ////////////////////////////////////////////////////////////////// NEW TICKER - -// loop rate used to determine how fast events trigger in the while loop -//Ticker main_loop_rate_ticker; -//Ticker log_loop_rate_ticker; volatile bool fsm_loop = false; //used so the compiler does not optimize this variable (load from memory, do not assume state of variable) volatile bool log_loop = false; //used so the compiler does not optimize this variable (load from memory, do not assume state of variable) @@ -42,15 +36,11 @@ // log loop runs at 1 hz if (log_loop) { //when the state machine is not in SIT_IDLE state (or a random keyboard press) - - //if (current_state == TRANSMIT_MBED_LOG or current_state == RECEIVE_SEQUENCE) { -// ; //pass -// } if(current_state != 0) { if (!file_opened) { //if the log file is not open, open it mbedLogger().appendLogFile(current_state, 0); //open MBED file once - sdLogger().appendLogFile(current_state, 0); //open SD file once + //sdLogger().appendLogFile(current_state, 0); //open SD file once file_opened = true; //stops it from continuing to open it @@ -60,7 +50,7 @@ //record to Mbed file system mbedLogger().appendLogFile(current_state, 1); //writing data - sdLogger().appendLogFile(current_state, 1); //writing data + //sdLogger().appendLogFile(current_state, 1); //writing data } //when the current FSM state is zero (SIT_IDLE), close the file @@ -69,10 +59,10 @@ if (file_opened) { //WRITE ONCE mbedLogger().appendLogFile(current_state, 1); //write the idle state, then close - sdLogger().appendLogFile(current_state, 1); //write the idle state, then close + //sdLogger().appendLogFile(current_state, 1); //write the idle state, then close mbedLogger().appendLogFile(current_state, 0); //close log file - sdLogger().appendLogFile(current_state, 0); //close log file + //sdLogger().appendLogFile(current_state, 0); //close log file file_opened = false; @@ -150,7 +140,7 @@ local(); // construct the SD card file system TEST 10/23/18 - sd_card(); + //sd_card(); // load config data from files configFileIO().load_BCE_config(); // load the buoyancy engine parameters from the file "bce.txt" @@ -213,7 +203,7 @@ //create log files if not present on file system mbedLogger().initializeLogFile(); - sdLogger().initializeLogFile(); // works 10/23/18 + //sdLogger().initializeLogFile(); // works 10/23/18 setup_complete = true; }