AP_Arming: Do not send a status text on state change

This commit is contained in:
Michael du Breuil 2023-10-23 11:04:36 -07:00 committed by WickedShell
parent 83a31ac371
commit 45786a33e6
2 changed files with 13 additions and 2 deletions

View File

@ -142,7 +142,7 @@ const AP_Param::GroupInfo AP_Arming::var_info[] = {
// @Param: OPTIONS
// @DisplayName: Arming options
// @Description: Options that can be applied to change arming behaviour
// @Values: 0:None,1:Disable prearm display
// @Values: 0:None,1:Disable prearm display,2:Do not send status text on state change
// @User: Advanced
AP_GROUPINFO("OPTIONS", 9, AP_Arming, _arming_options, 0),
@ -1725,6 +1725,14 @@ bool AP_Arming::disarm(const AP_Arming::Method method, bool do_disarm_checks)
return true;
}
void AP_Arming::send_arm_disarm_statustext(const char *str) const
{
if (option_enabled(AP_Arming::Option::DISABLE_STATUSTEXT_ON_STATE_CHANGE)) {
return;
}
gcs().send_text(MAV_SEVERITY_INFO, "%s", str);
}
AP_Arming::Required AP_Arming::arming_required() const
{
#if AP_OPENDRONEID_ENABLED

View File

@ -139,12 +139,15 @@ public:
// enum for ARMING_OPTIONS parameter
enum class Option : int32_t {
DISABLE_PREARM_DISPLAY = (1U << 0),
DISABLE_PREARM_DISPLAY = (1U << 0),
DISABLE_STATUSTEXT_ON_STATE_CHANGE = (1U << 1),
};
bool option_enabled(Option option) const {
return (_arming_options & uint32_t(option)) != 0;
}
void send_arm_disarm_statustext(const char *string) const;
static bool method_is_GCS(Method method) {
return (method == Method::MAVLINK || method == Method::DDS);
}