Copter: integrate winch arming checks

This commit is contained in:
Randy Mackay 2020-07-24 17:38:42 +09:00
parent 925f76c048
commit f607ff28b3
2 changed files with 26 additions and 2 deletions

View File

@ -61,8 +61,9 @@ bool AP_Arming_Copter::run_pre_arm_checks(bool display_failure)
& motor_checks(display_failure)
& pilot_throttle_checks(display_failure)
& oa_checks(display_failure)
& gcs_failsafe_check(display_failure) &
AP_Arming::pre_arm_checks(display_failure);
& gcs_failsafe_check(display_failure)
& winch_checks(display_failure)
& AP_Arming::pre_arm_checks(display_failure);
}
bool AP_Arming_Copter::barometer_checks(bool display_failure)
@ -575,6 +576,28 @@ bool AP_Arming_Copter::gcs_failsafe_check(bool display_failure)
return true;
}
// check winch
bool AP_Arming_Copter::winch_checks(bool display_failure) const
{
#if WINCH_ENABLED == ENABLED
// pass if parameter or all arming checks disabled
if (((checks_to_perform & ARMING_CHECK_ALL) == 0) && ((checks_to_perform & ARMING_CHECK_PARAMETERS) == 0)) {
return true;
}
const AP_Winch *winch = AP::winch();
if (winch == nullptr) {
return true;
}
char failure_msg[50] = {};
if (!winch->pre_arm_check(failure_msg, sizeof(failure_msg))) {
check_failed(display_failure, "%s", failure_msg);
return false;
}
#endif
return true;
}
// arm_checks - perform final checks before arming
// always called just before arming. Return true if ok to arm
// has side-effect that logging is started

View File

@ -50,6 +50,7 @@ protected:
bool oa_checks(bool display_failure);
bool mandatory_gps_checks(bool display_failure);
bool gcs_failsafe_check(bool display_failure);
bool winch_checks(bool display_failure) const;
void set_pre_arm_check(bool b);