From 2131daf42e77d65e31399703d7740b36ce3559c5 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Sun, 10 Apr 2016 22:28:03 +1000 Subject: [PATCH] NAV: More consistent detection of good GPS on arming. BEEPER_ARMING_GPS_FIX will be triggered based on position estimation status, not satellite count --- src/main/flight/navigation_rewrite.c | 8 +++++++- src/main/flight/navigation_rewrite.h | 1 + src/main/mw.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/flight/navigation_rewrite.c b/src/main/flight/navigation_rewrite.c index d116b31189..997d6d5c85 100755 --- a/src/main/flight/navigation_rewrite.c +++ b/src/main/flight/navigation_rewrite.c @@ -2109,6 +2109,12 @@ bool naivationBlockArming(void) return shouldBlockArming; } + +bool navigationPositionEstimateIsHealthy(void) +{ + return posControl.flags.hasValidPositionSensor && STATE(GPS_FIX_HOME); +} + /** * Indicate ready/not ready status */ @@ -2117,7 +2123,7 @@ static void updateReadyStatus(void) static bool posReadyBeepDone = false; /* Beep out READY_BEEP once when position lock is firstly acquired and HOME set */ - if (posControl.flags.hasValidPositionSensor && STATE(GPS_FIX_HOME) && !posReadyBeepDone) { + if (navigationPositionEstimateIsHealthy() && !posReadyBeepDone) { beeper(BEEPER_READY_BEEP); posReadyBeepDone = true; } diff --git a/src/main/flight/navigation_rewrite.h b/src/main/flight/navigation_rewrite.h index d9d16e042f..6ad4f35673 100755 --- a/src/main/flight/navigation_rewrite.h +++ b/src/main/flight/navigation_rewrite.h @@ -241,6 +241,7 @@ bool naivationRequiresAngleMode(void); bool navigationRequiresThrottleTiltCompensation(void); int8_t naivationGetHeadingControlState(void); bool naivationBlockArming(void); +bool navigationPositionEstimateIsHealthy(void); /* Access to estimated position and velocity */ float getEstimatedActualVelocity(int axis); diff --git a/src/main/mw.c b/src/main/mw.c index 8b05a005e0..b1578f17c7 100755 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -260,8 +260,8 @@ void mwArm(void) disarmAt = millis() + masterConfig.auto_disarm_delay * 1000; // start disarm timeout, will be extended when throttle is nonzero //beep to indicate arming -#ifdef GPS - if (feature(FEATURE_GPS) && STATE(GPS_FIX) && gpsSol.numSat >= 5) +#ifdef NAV + if (navigationPositionEstimateIsHealthy()) beeper(BEEPER_ARMING_GPS_FIX); else beeper(BEEPER_ARMING);