mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 06:53:34 +08:00
hardfault_log:Not having a ulog file to append to is not an error
The hardfault keeps track of the number of reboot without a commit to disk. A commit to disk is the act of writing the fault data from the bbsram to the hardfault file, not the ulog file. The sucessful commit rearms the hardfault system. When ulog appending was added it treated the lack of a ulog file as an error. This prevented the hardfault_log reset from being called because the hardfault_log commit returned an error. if hardfault_log check then if hardfault_log commit then hardfault_log reset fi fi This change treats the lack a a ulog as a non error.
This commit is contained in:
@@ -617,6 +617,10 @@ static int hardfault_append_to_ulog(const char *caller, int fdin)
|
||||
close(fd);
|
||||
ulog_file_name[HARDFAULT_MAX_ULOG_FILE_LEN - 1] = 0; //ensure null-termination
|
||||
|
||||
if (strlen(ulog_file_name) == 0) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
identify(caller);
|
||||
syslog(LOG_INFO, "Appending to ULog %s\n", ulog_file_name);
|
||||
|
||||
@@ -823,14 +827,21 @@ static int hardfault_commit(char *caller)
|
||||
// .txt file around, since that is a bit less prone to FS errors than the ULog
|
||||
if (ret == OK) {
|
||||
ret = hardfault_append_to_ulog(caller, fdout);
|
||||
identify(caller);
|
||||
|
||||
if (ret == OK) {
|
||||
identify(caller);
|
||||
switch (ret) {
|
||||
case OK:
|
||||
syslog(LOG_INFO, "Successfully appended to ULog\n");
|
||||
break;
|
||||
|
||||
} else {
|
||||
identify(caller);
|
||||
case -ENOENT:
|
||||
syslog(LOG_INFO, "No ULog to append to\n");
|
||||
ret = OK;
|
||||
break;
|
||||
|
||||
default:
|
||||
syslog(LOG_INFO, "Failed to append to ULog (%i)\n", ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user