mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-05 14:17:20 +08:00
Support for new log file extension. (#5355)
This commit is contained in:
@@ -456,7 +456,7 @@ LogListHelper::_init()
|
|||||||
}
|
}
|
||||||
if (entry.d_type == PX4LOG_DIRECTORY)
|
if (entry.d_type == PX4LOG_DIRECTORY)
|
||||||
{
|
{
|
||||||
time_t tt;
|
time_t tt = 0;
|
||||||
char log_path[128];
|
char log_path[128];
|
||||||
snprintf(log_path, sizeof(log_path), "%s/%s", kLogRoot, entry.d_name);
|
snprintf(log_path, sizeof(log_path), "%s/%s", kLogRoot, entry.d_name);
|
||||||
if (_get_session_date(log_path, entry.d_name, tt)) {
|
if (_get_session_date(log_path, entry.d_name, tt)) {
|
||||||
@@ -533,28 +533,30 @@ LogListHelper::_scan_logs(FILE* f, const char* dir, time_t& date)
|
|||||||
bool
|
bool
|
||||||
LogListHelper::_get_log_time_size(const char* path, const char* file, time_t& date, uint32_t& size)
|
LogListHelper::_get_log_time_size(const char* path, const char* file, time_t& date, uint32_t& size)
|
||||||
{
|
{
|
||||||
if(file && file[0] && strstr(file, ".px4log")) {
|
if(file && file[0]) {
|
||||||
// Convert "log000" to 00:00 (minute per flight in session)
|
if(strstr(file, ".px4log") || strstr(file, ".ulg")) {
|
||||||
if (strncmp(file, "log", 3) == 0) {
|
// Convert "log000" to 00:00 (minute per flight in session)
|
||||||
unsigned u;
|
if (strncmp(file, "log", 3) == 0) {
|
||||||
if(sscanf(&file[3], "%u", &u) == 1) {
|
unsigned u;
|
||||||
date += (u * 60);
|
if(sscanf(&file[3], "%u", &u) == 1) {
|
||||||
if (stat_file(path, 0, &size)) {
|
date += (u * 60);
|
||||||
|
if (stat_file(path, 0, &size)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (stat_file(path, &date, &size)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/* strptime not available for some reason
|
||||||
|
// Get time from file name
|
||||||
|
struct tm tt;
|
||||||
|
if(strptime(file, "%H_%M_%S", &tt)) {
|
||||||
|
date += mktime(&tt);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (stat_file(path, &date, &size)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/* strptime not available for some reason
|
|
||||||
// Get time from file name
|
|
||||||
struct tm tt;
|
|
||||||
if(strptime(file, "%H_%M_%S", &tt)) {
|
|
||||||
date += mktime(&tt);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user