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: StateMachine/StateMachine.cpp
- Revision:
- 71:939d179478c4
- Parent:
- 70:0e5180befedd
- Child:
- 72:250b2665755c
--- a/StateMachine/StateMachine.cpp Fri Jun 29 18:26:50 2018 +0000 +++ b/StateMachine/StateMachine.cpp Fri Jun 29 21:52:31 2018 +0000 @@ -680,16 +680,16 @@ break; - case TRANSMIT_MBED_LOG: + case TX_MBED_LOG: if (!_isTimeoutRunning) { - pc().printf("\r\n\nstate: TRANSMIT_MBED_LOG\r\n"); + pc().printf("\r\n\nstate: TX_MBED_LOG\r\n"); timer.reset(); // timer goes back to zero timer.start(); // background timer starts running _isTimeoutRunning = true; //mbedLogger().openFileForTransmit(); //starts _fp file pointer at the beginning of the file - pc().printf("TRANSMIT_MBED_LOG set to zero\n\r"); + pc().printf("TX_MBED_LOG set to zero\n\r"); //function to read the file and get number of lines (packets to transmit) _timeout = mbedLogger().getNumberOfPacketsInCurrentLog(); @@ -699,8 +699,7 @@ //TIMED OUT if (timer.read() > _timeout) { - //mbedLogger().closeLogFile(); //on timeout close the log file that was opened for reading - //pc().printf("\r\nTRANSMIT_MBED_LOG: timed out!\r\n"); + pc().printf("\r\TX_MBED_LOG: timed out!\r\n"); //STATE _state = SIT_IDLE; @@ -708,27 +707,14 @@ timer.reset(); _isTimeoutRunning = false; - //send a command to the Python GUI to stop looking for data - //SEND COMMAND WHEN TRANSMISSION ENDS PREMATURELY - //pc().printf("%c%c%c%c",0x15,0x15,0x15,0x15); - - mbedLogger().closeLogFile(); //test 6/27 - pc().printf("\r\n\nstate: TRANSMIT_MBED_LOG (log filed closed)\r\n"); + mbedLogger().closeLogFile(); + pc().printf("\r\n\nstate: TX_MBED_LOG (log filed closed)\r\n"); } //What is active? mbedLogger().fsmTransmitData(); mbedLogger().checkForPythonTransmitRequest(); - //boolean function that transmits until it's finished -// if (mbedLogger().fsmTransmitData()) -// ; -// else { -// pc().printf("StateMachine: TRANSMIT_MBED_LOG (closeLogFile)\n\n\r"); -// mbedLogger().closeLogFile(); -// _state = SIT_IDLE; -// } - break; case RECEIVE_SEQUENCE : @@ -784,8 +770,7 @@ pc().printf(" B to float at broadcast pitch\r\n"); pc().printf(" E to initiate emergency climb\r\n"); pc().printf(" P to print the current log file.\r\n"); - pc().printf(" O to transmit current log file.\r\n"); - pc().printf(" G to MBED_TRANSMIT_LOG\r\n"); + pc().printf(" G to TX_MBED_LOG\r\n"); pc().printf(" ~ to erase mbed log file. (clear before logging more than a few runs)\r\n"); 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); @@ -1141,9 +1126,6 @@ else if (user_input == 'X') { mbedLogger().printMbedDirectory(); //print all log files to the screen } - else if (user_input == 'O') { - mbedLogger().continuouslyTransmitDataNoTimer(); //_keyboard_state = TRANSMIT_MBED_LOG; //Transmit data (work in progress) - } else if (user_input == 'I') { mbedLogger().receiveMissionDataWithTicker(); //receive sequence.txt files } @@ -1403,14 +1385,10 @@ //Print current SD card log file //printCurrentSdLog(); mbedLogger().printCurrentLogFile(); //print the current log file to the screen - } - else if (user_input == 'O') { - mbedLogger().continuouslyTransmitDataNoTimer(); - } - + } else if (user_input == 'G') { wait(1); - _keyboard_state = TRANSMIT_MBED_LOG; + _keyboard_state = TX_MBED_LOG; } else if (user_input == '~') {