1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-19 14:25:16 +03:00

NAV: More consistent detection of good GPS on arming. BEEPER_ARMING_GPS_FIX will be triggered based on position estimation status, not satellite count

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2016-04-10 22:28:03 +10:00
parent e5726c3c35
commit 2131daf42e
3 changed files with 10 additions and 3 deletions

View file

@ -2109,6 +2109,12 @@ bool naivationBlockArming(void)
return shouldBlockArming; return shouldBlockArming;
} }
bool navigationPositionEstimateIsHealthy(void)
{
return posControl.flags.hasValidPositionSensor && STATE(GPS_FIX_HOME);
}
/** /**
* Indicate ready/not ready status * Indicate ready/not ready status
*/ */
@ -2117,7 +2123,7 @@ static void updateReadyStatus(void)
static bool posReadyBeepDone = false; static bool posReadyBeepDone = false;
/* Beep out READY_BEEP once when position lock is firstly acquired and HOME set */ /* 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); beeper(BEEPER_READY_BEEP);
posReadyBeepDone = true; posReadyBeepDone = true;
} }

View file

@ -241,6 +241,7 @@ bool naivationRequiresAngleMode(void);
bool navigationRequiresThrottleTiltCompensation(void); bool navigationRequiresThrottleTiltCompensation(void);
int8_t naivationGetHeadingControlState(void); int8_t naivationGetHeadingControlState(void);
bool naivationBlockArming(void); bool naivationBlockArming(void);
bool navigationPositionEstimateIsHealthy(void);
/* Access to estimated position and velocity */ /* Access to estimated position and velocity */
float getEstimatedActualVelocity(int axis); float getEstimatedActualVelocity(int axis);

View file

@ -260,8 +260,8 @@ void mwArm(void)
disarmAt = millis() + masterConfig.auto_disarm_delay * 1000; // start disarm timeout, will be extended when throttle is nonzero disarmAt = millis() + masterConfig.auto_disarm_delay * 1000; // start disarm timeout, will be extended when throttle is nonzero
//beep to indicate arming //beep to indicate arming
#ifdef GPS #ifdef NAV
if (feature(FEATURE_GPS) && STATE(GPS_FIX) && gpsSol.numSat >= 5) if (navigationPositionEstimateIsHealthy())
beeper(BEEPER_ARMING_GPS_FIX); beeper(BEEPER_ARMING_GPS_FIX);
else else
beeper(BEEPER_ARMING); beeper(BEEPER_ARMING);