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

Use an STATE() flag instead of an static variable in navigation.c

Also, make the check for setting the STATE() flag clearer. Previous
implementation was a bit confusing.
This commit is contained in:
Alberto García Hierro 2019-04-25 13:59:20 +01:00
parent dc6d002bdc
commit 20fac46ee0
4 changed files with 23 additions and 30 deletions

View file

@ -167,7 +167,6 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
navigationPosControl_t posControl;
navSystemStatus_t NAV_Status;
static bool blockingArmingBypassWithoutSticks;
#if defined(NAV_BLACKBOX)
int16_t navCurrentState;
@ -2938,7 +2937,7 @@ navArmingBlocker_e navigationIsBlockingArming(bool *usedBypass)
// Apply extra arming safety only if pilot has any of GPS modes configured
if ((isUsingNavigationModes() || failsafeMayRequireNavigationMode()) && !((posControl.flags.estPosStatus >= EST_USABLE) && STATE(GPS_FIX_HOME))) {
if (navConfig()->general.flags.extra_arming_safety == NAV_EXTRA_ARMING_SAFETY_ALLOW_BYPASS &&
(blockingArmingBypassWithoutSticks || rxGetChannelValue(YAW) > 1750)) {
(STATE(NAV_EXTRA_ARMING_SAFETY_BYPASSED) || rxGetChannelValue(YAW) > 1750)) {
if (usedBypass) {
*usedBypass = true;
}
@ -2967,11 +2966,6 @@ navArmingBlocker_e navigationIsBlockingArming(bool *usedBypass)
return NAV_ARMING_BLOCKER_NONE;
}
void navigationSetBlockingArmingBypassWithoutSticks(bool allow)
{
blockingArmingBypassWithoutSticks = allow;
}
bool navigationPositionEstimateIsHealthy(void)
{
return (posControl.flags.estPosStatus >= EST_USABLE) && STATE(GPS_FIX_HOME);