AP_Arming: pre-arm check for disarm aux switch

This commit is contained in:
Tatsuya Yamaguchi 2020-04-30 23:57:44 +09:00 committed by Randy Mackay
parent 4fdd24ecd3
commit de854a2ffe
2 changed files with 17 additions and 1 deletions

View File

@ -1055,7 +1055,8 @@ bool AP_Arming::pre_arm_checks(bool report)
& proximity_checks(report)
& camera_checks(report)
& visodom_checks(report)
& aux_auth_checks(report);
& aux_auth_checks(report)
& disarm_switch_checks(report);
}
bool AP_Arming::arm_checks(AP_Arming::Method method)
@ -1216,6 +1217,20 @@ bool AP_Arming::visodom_checks(bool display_failure) const
return true;
}
// check disarm switch is asserted
bool AP_Arming::disarm_switch_checks(bool display_failure) const
{
const RC_Channel *chan = rc().find_channel_for_option(RC_Channel::AUX_FUNC::DISARM);
if (chan != nullptr &&
chan->get_aux_switch_pos() == RC_Channel::aux_switch_pos_t::HIGH &&
(checks_to_perform & ARMING_CHECK_ALL)) {
check_failed(display_failure, "Disarm Switch on");
return false;
}
return true;
}
void AP_Arming::Log_Write_Arm(const bool forced, const AP_Arming::Method method)
{
const struct log_Arm_Disarm pkt {

View File

@ -175,6 +175,7 @@ protected:
bool rc_checks_copter_sub(bool display_failure, const RC_Channel *channels[4]) const;
bool visodom_checks(bool report) const;
bool disarm_switch_checks(bool report) const;
// mandatory checks that cannot be bypassed. This function will only be called if ARMING_CHECK is zero or arming forced
virtual bool mandatory_checks(bool report) { return true; }