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: MbedLogger/MbedLogger.cpp
- Revision:
- 71:939d179478c4
- Parent:
- 70:0e5180befedd
- Child:
- 72:250b2665755c
--- a/MbedLogger/MbedLogger.cpp Fri Jun 29 18:26:50 2018 +0000 +++ b/MbedLogger/MbedLogger.cpp Fri Jun 29 21:52:31 2018 +0000 @@ -91,8 +91,8 @@ string_state = "POSITION_DIVE"; else if (current_state == POSITION_RISE) string_state = "POSITION_RISE"; - else if (current_state == TRANSMIT_MBED_LOG) - string_state = "TRANSMIT_MBED_LOG"; + else if (current_state == TX_MBED_LOG) + string_state = "TX_MBED_LOG"; else if (current_state == RECEIVE_SEQUENCE) string_state = "RECEIVE_SEQUENCE"; @@ -293,8 +293,6 @@ while(!feof(_fp)) { _packet_number = packet_num; - - //fseek readPacketInSeries(); //not using this but for testing purposes... @@ -348,25 +346,7 @@ } } -void MbedLogger::continuouslyTransmitData() { - static int packet_num = 0; - - while(!feof(_fp)) { - wait(0.1); - - _packet_number = packet_num; - - transmitPacketNumber(packet_num); - - //check for incoming transmission - //python? - - packet_num++; - - led3() = !led3(); - } -} - +//transmitting log file with fixed length of characters to receiver program void MbedLogger::transmitPacketNumber(int line_number) { int line_size = 160; //length of lines in the log file, EVERY LINE MUST BE THE SAME LENGTH @@ -381,6 +361,9 @@ // uses char _line_buffer[256] variable to hold characters read from the file // packs this into a vector for transmission + //change the internal member variable for packet number, reorg this later + _packet_number = line_number; + createDataPacket(_line_buffer, line_size); //create the data packet from the _line_buffer (char array) transmitDataPacket(); //transmit the assembled packet