AP_Arming: display 'Arm: ' instead of 'PreArm: ' for arming failures
Before this patch we would display PreArm: even if the checks were being performed as part of the arming sequence. This lets us distinguish betwee checks failing because the user is trying to arm the vehicle and when the prearms are running while disarmed (or triggered via GCS)
This commit is contained in:
parent
8b02f11c23
commit
f5a8561fde
@ -215,7 +215,16 @@ void AP_Arming::check_failed(const enum AP_Arming::ArmingChecks check, bool repo
|
||||
return;
|
||||
}
|
||||
char taggedfmt[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
|
||||
hal.util->snprintf(taggedfmt, sizeof(taggedfmt), "PreArm: %s", fmt);
|
||||
|
||||
// metafmt is wrapped around the passed-in format string to
|
||||
// prepend "PreArm" or "Arm", depending on what sorts of checks
|
||||
// we're currently doing.
|
||||
const char *metafmt = "PreArm: %s"; // it's formats all the way down
|
||||
if (running_arming_checks) {
|
||||
metafmt = "Arm: %s";
|
||||
}
|
||||
hal.util->snprintf(taggedfmt, sizeof(taggedfmt), metafmt, fmt);
|
||||
|
||||
MAV_SEVERITY severity = check_severity(check);
|
||||
va_list arg_list;
|
||||
va_start(arg_list, fmt);
|
||||
@ -229,7 +238,16 @@ void AP_Arming::check_failed(bool report, const char *fmt, ...) const
|
||||
return;
|
||||
}
|
||||
char taggedfmt[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
|
||||
hal.util->snprintf(taggedfmt, sizeof(taggedfmt), "PreArm: %s", fmt);
|
||||
|
||||
// metafmt is wrapped around the passed-in format string to
|
||||
// prepend "PreArm" or "Arm", depending on what sorts of checks
|
||||
// we're currently doing.
|
||||
const char *metafmt = "PreArm: %s"; // it's formats all the way down
|
||||
if (running_arming_checks) {
|
||||
metafmt = "Arm: %s";
|
||||
}
|
||||
hal.util->snprintf(taggedfmt, sizeof(taggedfmt), metafmt, fmt);
|
||||
|
||||
va_list arg_list;
|
||||
va_start(arg_list, fmt);
|
||||
gcs().send_textv(MAV_SEVERITY_CRITICAL, taggedfmt, arg_list);
|
||||
@ -1426,6 +1444,8 @@ bool AP_Arming::arm(AP_Arming::Method method, const bool do_arming_checks)
|
||||
return false;
|
||||
}
|
||||
|
||||
running_arming_checks = true; // so we show Arm: rather than Disarm: in messages
|
||||
|
||||
if ((!do_arming_checks && mandatory_checks(true)) || (pre_arm_checks(true) && arm_checks(method))) {
|
||||
armed = true;
|
||||
|
||||
@ -1436,6 +1456,8 @@ bool AP_Arming::arm(AP_Arming::Method method, const bool do_arming_checks)
|
||||
armed = false;
|
||||
}
|
||||
|
||||
running_arming_checks = false;
|
||||
|
||||
if (armed && do_arming_checks && checks_to_perform == 0) {
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Warning: Arming Checks Disabled");
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ private:
|
||||
Method _last_disarm_method = Method::UNKNOWN;
|
||||
|
||||
uint32_t last_prearm_display_ms; // last time we send statustexts for prearm failures
|
||||
bool running_arming_checks; // true if the arming checks currently being performed are being done because the vehicle is trying to arm the vehicle
|
||||
};
|
||||
|
||||
namespace AP {
|
||||
|
Loading…
Reference in New Issue
Block a user