AP_Arming: integrate ahrs.pre_arm_check

This commit is contained in:
Randy Mackay 2020-08-11 14:04:10 +09:00 committed by Peter Barker
parent eeb1a1846c
commit eeaf135cca
2 changed files with 7 additions and 13 deletions

View File

@ -509,12 +509,9 @@ bool AP_Arming_Copter::mandatory_gps_checks(bool display_failure)
{ {
// always check if inertial nav has started and is ready // always check if inertial nav has started and is ready
const AP_AHRS_NavEKF &ahrs = AP::ahrs_navekf(); const AP_AHRS_NavEKF &ahrs = AP::ahrs_navekf();
if (!ahrs.prearm_healthy()) { char failure_msg[50] = {};
const char *reason = ahrs.prearm_failure_reason(); if (!ahrs.pre_arm_check(failure_msg, sizeof(failure_msg))) {
if (reason == nullptr) { check_failed(display_failure, "%s", failure_msg);
reason = "AHRS not healthy";
}
check_failed(display_failure, "%s", reason);
return false; return false;
} }
@ -530,7 +527,7 @@ bool AP_Arming_Copter::mandatory_gps_checks(bool display_failure)
if (mode_requires_gps) { if (mode_requires_gps) {
if (!copter.position_ok()) { if (!copter.position_ok()) {
// There is no need to call prearm_failure_reason again, because prearm_healthy sure be true if we reach here // vehicle level position estimate checks
check_failed(display_failure, "Need Position Estimate"); check_failed(display_failure, "Need Position Estimate");
return false; return false;
} }

View File

@ -124,12 +124,9 @@ bool AP_Arming_Plane::ins_checks(bool display_failure)
// additional plane specific checks // additional plane specific checks
if ((checks_to_perform & ARMING_CHECK_ALL) || if ((checks_to_perform & ARMING_CHECK_ALL) ||
(checks_to_perform & ARMING_CHECK_INS)) { (checks_to_perform & ARMING_CHECK_INS)) {
if (!AP::ahrs().prearm_healthy()) { char failure_msg[50] = {};
const char *reason = AP::ahrs().prearm_failure_reason(); if (!AP::ahrs().pre_arm_check(failure_msg, sizeof(failure_msg))) {
if (reason == nullptr) { check_failed(ARMING_CHECK_INS, display_failure, "%s", failure_msg);
reason = "AHRS not healthy";
}
check_failed(ARMING_CHECK_INS, display_failure, "%s", reason);
return false; return false;
} }
} }