From 52666232ed47b811ea54967e2c1c840bb287444b Mon Sep 17 00:00:00 2001 From: Michael du Breuil Date: Sun, 20 Dec 2015 23:34:00 -0700 Subject: [PATCH] AP_Arming: Allow arming without the hardware safety switch having been pressed Added an enum to the check type that allows for arming without the hardware switch having been enabled --- libraries/AP_Arming/AP_Arming.cpp | 20 ++++++++++++-------- libraries/AP_Arming/AP_Arming.h | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index a0ce155fb9..4e8a97bd9d 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -37,8 +37,8 @@ const AP_Param::GroupInfo AP_Arming::var_info[] = { // @Param: CHECK // @DisplayName: Arm Checks to Peform (bitmask) // @Description: Checks prior to arming motor. This is a bitmask of checks that will be performed befor allowing arming. The default is no checks, allowing arming at any time. You can select whatever checks you prefer by adding together the values of each check type to set this parameter. For example, to only allow arming when you have GPS lock and no RC failsafe you would set ARMING_CHECK to 72. For most users it is recommended that you set this to 1 to enable all checks. - // @Values: 0:None,1:All,2:Barometer,4:Compass,8:GPS,16:INS(INertial Sensors - accels & gyros),32:Parameters(unused),64:RC Failsafe,128:Board voltage,256:Battery Level,512:Airspeed,1024:LoggingAvailable - // @Bitmask: 0:All,1:Barometer,2:Compass,3:GPS,4:INS,5:Parameters,6:RC,7:Board voltage,8:Battery Level,9:Airspeed,10:Logging Available + // @Values: 0:None,1:All,2:Barometer,4:Compass,8:GPS,16:INS(INertial Sensors - accels & gyros),32:Parameters(unused),64:RC Failsafe,128:Board voltage,256:Battery Level,512:Airspeed,1024:LoggingAvailable,2048:Hardware safety switch + // @Bitmask: 0:All,1:Barometer,2:Compass,3:GPS,4:INS,5:Parameters,6:RC,7:Board voltage,8:Battery Level,9:Airspeed,10:Logging Available,11:Hardware safety switch // @User: Standard AP_GROUPINFO("CHECK", 2, AP_Arming, checks_to_perform, ARMING_CHECK_ALL), @@ -318,12 +318,16 @@ bool AP_Arming::battery_checks(bool report) bool AP_Arming::hardware_safety_check(bool report) { - // check if safety switch has been pushed - if (hal.util->safety_switch_state() == AP_HAL::Util::SAFETY_DISARMED) { - if (report) { - GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, "PreArm: Hardware safety switch"); - } - return false; + if ((checks_to_perform & ARMING_CHECK_ALL) || + (checks_to_perform & ARMING_CHECK_SWITCH)) { + + // check if safety switch has been pushed + if (hal.util->safety_switch_state() == AP_HAL::Util::SAFETY_DISARMED) { + if (report) { + GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, "PreArm: Hardware safety switch"); + } + return false; + } } return true; diff --git a/libraries/AP_Arming/AP_Arming.h b/libraries/AP_Arming/AP_Arming.h index 711285b7e4..438dc6e1fc 100644 --- a/libraries/AP_Arming/AP_Arming.h +++ b/libraries/AP_Arming/AP_Arming.h @@ -23,6 +23,7 @@ public: ARMING_CHECK_BATTERY = 0x0100, ARMING_CHECK_AIRSPEED = 0x0200, ARMING_CHECK_LOGGING = 0x0400, + ARMING_CHECK_SWITCH = 0x0800, }; enum ArmingMethod {