failureDetectorCheck: remove string manipulation

This commit is contained in:
Matthias Grob 2020-09-07 18:52:44 +02:00
parent 5eba25d2b5
commit f70dda12a6
1 changed files with 5 additions and 10 deletions

View File

@ -45,30 +45,25 @@ bool PreFlightCheck::failureDetectorCheck(orb_advert_t *mavlink_log_pub, const v
if (status.failure_detector_status != vehicle_status_s::FAILURE_NONE) {
if (report_fail) {
// in case an error is forgotten to get handled here the user at least gets a less specific message
const char *message = "Unspecified";
if (status.failure_detector_status & vehicle_status_s::FAILURE_ROLL) {
message = "Roll";
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Roll failure detected");
}
if (status.failure_detector_status & vehicle_status_s::FAILURE_PITCH) {
message = "Pitch";
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Pitch failure detected");
}
if (status.failure_detector_status & vehicle_status_s::FAILURE_ALT) {
message = "Altitude";
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Altitude failure detected");
}
if (status.failure_detector_status & vehicle_status_s::FAILURE_EXT) {
message = "Parachute";
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Parachute failure detected");
}
if (status.failure_detector_status & vehicle_status_s::FAILURE_ARM_ESC) {
message = "ESC";
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: ESC failure detected");
}
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: %s failure detected", message);
}
return false;