Copter: ahrs only checks position in modes that require it

This commit is contained in:
Randy Mackay 2021-01-21 13:16:29 +09:00 committed by Andrew Tridgell
parent f6cb0819ef
commit dc515b87df
1 changed files with 4 additions and 4 deletions

View File

@ -511,17 +511,17 @@ bool AP_Arming_Copter::proximity_checks(bool display_failure) const
// performs mandatory gps checks. returns true if passed
bool AP_Arming_Copter::mandatory_gps_checks(bool display_failure)
{
// check if flight mode requires GPS
bool mode_requires_gps = copter.flightmode->requires_GPS();
// always check if inertial nav has started and is ready
const AP_AHRS_NavEKF &ahrs = AP::ahrs_navekf();
char failure_msg[50] = {};
if (!ahrs.pre_arm_check(failure_msg, sizeof(failure_msg))) {
if (!ahrs.pre_arm_check(mode_requires_gps, failure_msg, sizeof(failure_msg))) {
check_failed(display_failure, "AHRS: %s", failure_msg);
return false;
}
// check if flight mode requires GPS
bool mode_requires_gps = copter.flightmode->requires_GPS();
// check if fence requires GPS
bool fence_requires_gps = false;
#if AC_FENCE == ENABLED