From b698546b70371108058045c53bd9c78a8f869d81 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 6 Jan 2021 11:15:48 +1100 Subject: [PATCH] ArduPlane: add do_disarm_checks boolean to disarm call this creates symmetry between arming and disarming, at least as far as the top-level arm() and disarm() calls are concerned. --- ArduPlane/AP_Arming.cpp | 7 ++++--- ArduPlane/AP_Arming.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ArduPlane/AP_Arming.cpp b/ArduPlane/AP_Arming.cpp index d3c0c2d879..6e6c0a4bfe 100644 --- a/ArduPlane/AP_Arming.cpp +++ b/ArduPlane/AP_Arming.cpp @@ -230,9 +230,10 @@ bool AP_Arming_Plane::arm(const AP_Arming::Method method, const bool do_arming_c /* disarm motors */ -bool AP_Arming_Plane::disarm(const AP_Arming::Method method) +bool AP_Arming_Plane::disarm(const AP_Arming::Method method, bool do_disarm_checks) { - if (method == AP_Arming::Method::RUDDER) { + if (do_disarm_checks && + method == AP_Arming::Method::RUDDER) { // don't allow rudder-disarming in flight: if (plane.is_flying()) { // obviously this could happen in-flight so we can't warn about it @@ -245,7 +246,7 @@ bool AP_Arming_Plane::disarm(const AP_Arming::Method method) } } - if (!AP_Arming::disarm(method)) { + if (!AP_Arming::disarm(method, do_disarm_checks)) { return false; } if (plane.control_mode != &plane.mode_auto) { diff --git a/ArduPlane/AP_Arming.h b/ArduPlane/AP_Arming.h index 298dd9d869..26b0fb63f8 100644 --- a/ArduPlane/AP_Arming.h +++ b/ArduPlane/AP_Arming.h @@ -24,7 +24,7 @@ public: // var_info for holding Parameter information static const struct AP_Param::GroupInfo var_info[]; - bool disarm(AP_Arming::Method method) override; + bool disarm(AP_Arming::Method method, bool do_disarm_checks=true) override; bool arm(AP_Arming::Method method, bool do_arming_checks=true) override; void update_soft_armed();