1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 16:55:29 +03:00

Extend extra arming safety - prevent arming when any of NAV modes is selected

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2016-04-10 14:03:49 +10:00
parent 0aa1ae6ffd
commit 8ac607c47c

View file

@ -2086,16 +2086,22 @@ int8_t naivationGetHeadingControlState(void)
bool naivationBlockArming(void)
{
bool shouldBlockArming = false;
if (!posControl.navConfig->flags.extra_arming_safety)
return false;
// Apply extra arming safety only if pilot has any of GPS modes configured
if (isUsingNavigationModes() || failsafeMayRequireNavigationMode()) {
return !(posControl.flags.hasValidPositionSensor && STATE(GPS_FIX_HOME));
if ((isUsingNavigationModes() || failsafeMayRequireNavigationMode()) && !(posControl.flags.hasValidPositionSensor && STATE(GPS_FIX_HOME))) {
shouldBlockArming = true;
}
else {
return false;
// Don't allow arming if any of NAV modes is active
if ((!ARMING_FLAG(ARMED)) && (IS_RC_MODE_ACTIVE(BOXPASSTHRU) || IS_RC_MODE_ACTIVE(BOXNAVWP) || IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD) || IS_RC_MODE_ACTIVE(BOXNAVALTHOLD))) {
shouldBlockArming = true;
}
return shouldBlockArming;
}
/**