From a4d3607de1ee65261ee398673c4c57b0a9808b87 Mon Sep 17 00:00:00 2001 From: Tatsuya Yamaguchi Date: Tue, 26 Apr 2022 15:43:21 +0900 Subject: [PATCH] Copter: move Disarm/EStop/Interlock check from arm_checks to run_pre_arm_checks --- ArduCopter/AP_Arming.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/ArduCopter/AP_Arming.cpp b/ArduCopter/AP_Arming.cpp index 50e774ce15..3b311bf037 100644 --- a/ArduCopter/AP_Arming.cpp +++ b/ArduCopter/AP_Arming.cpp @@ -46,10 +46,20 @@ bool AP_Arming_Copter::run_pre_arm_checks(bool display_failure) // check if motor interlock aux switch is in use // if it is, switch needs to be in disabled position to arm - // otherwise exit immediately. This check to be repeated, - // as state can change at any time. + // otherwise exit immediately. if (copter.ap.using_interlock && copter.ap.motor_interlock_switch) { check_failed(display_failure, "Motor Interlock Enabled"); + return false; + } + + // if we are using motor Estop switch, it must not be in Estop position + if (SRV_Channels::get_emergency_stop()){ + check_failed(display_failure, "Motor Emergency Stopped"); + return false; + } + + if (!disarm_switch_checks(display_failure)) { + return false; } // if pre arm checks are disabled run only the mandatory checks @@ -636,19 +646,6 @@ bool AP_Arming_Copter::arm_checks(AP_Arming::Method method) return false; } - // if we are using motor interlock switch and it's enabled, fail to arm - // skip check in Throw mode which takes control of the motor interlock - if (copter.ap.using_interlock && copter.ap.motor_interlock_switch) { - check_failed(true, "Motor Interlock Enabled"); - return false; - } - - // if we are using motor Estop switch, it must not be in Estop position - if (SRV_Channels::get_emergency_stop()){ - check_failed(true, "Motor Emergency Stopped"); - return false; - } - // succeed if arming checks are disabled if (checks_to_perform == 0) { return true;