Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MODSERIAL FATFileSystem
Diff: MbedLogger/MbedLogger.cpp
- Revision:
- 87:6d95f853dab3
- Parent:
- 86:ba3a118b0080
- Child:
- 99:9d0849f5fcd7
- Child:
- 102:0f430de62447
diff -r ba3a118b0080 -r 6d95f853dab3 MbedLogger/MbedLogger.cpp
--- a/MbedLogger/MbedLogger.cpp Thu May 02 20:34:16 2019 +0000
+++ b/MbedLogger/MbedLogger.cpp Wed May 08 13:24:04 2019 +0000
@@ -29,6 +29,7 @@
_default_timestamp_time = 1518467832;
_end_sequence_transmission = false;
+ _time_set =0;
}
//this function has to be called for the time to function correctly
@@ -38,6 +39,7 @@
else { set_time(setting_time); _default_timestamp_time = setting_time; }
xbee().printf("\n%s log time set.\n\r", _file_system_string.c_str());
// set_time(time_stamp); // Set RTC time to Mon, 12 FEB 2018 15:37
+ _time_set =1;
}
//in the future create the ability to set the start time
@@ -50,6 +52,7 @@
void MbedLogger::recordData(int current_state) {
int data_log_time = mbedLogger().getSystemTime(); //read the system timer to get unix timestamp
int start_time = 1518467832;
+ if(_time_set) { start_time = _default_timestamp_time;}
_data_log[0] = depthLoop().getCommand(); //depth command
_data_log[1] = depthLoop().getPosition(); //depth reading (filtered depth)
_data_log[2] = pitchLoop().getCommand(); //pitch command
@@ -95,7 +98,8 @@
_data_log[34] = headingLoop().getFilterFrequency();
_data_log[35] = headingLoop().getDeadband();
- string string_state;
+ string string_state; string_state= "UNKNOWN"; //default just in case.
+
if (current_state == SIT_IDLE)
string_state = "SIT_IDLE";
else if (current_state == FIND_NEUTRAL)
@@ -132,6 +136,10 @@
string_state = "LEG_POS_RISE";
else if (current_state == FB_EXIT)
string_state = "FB_EXIT";
+ else if (current_state == START_SWIM)
+ string_state = "START_SWIM";
+ else if (current_state == FLYING_IDLE)
+ string_state = "FLYING_IDLE";
else if (current_state == ENDLEG_WAIT)
string_state = "ENDLEG_WAIT";
@@ -1275,7 +1283,8 @@
void MbedLogger::appendDiagFile(char *printf_string, int flushclose) {
//
- int start_time = 1518467832;
+ int start_time = 1518467832;
+ if(_time_set) { start_time = _default_timestamp_time;}
//in the future create the ability to set the start time
int time_now = mbedLogger().getSystemTime();