1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-17 13:25:27 +03:00

Disable ALTHOLD on user motor stop request

This commit is contained in:
Michel Pastor 2018-06-04 15:10:06 +02:00
parent 99f7b1daf2
commit f046554d97
4 changed files with 40 additions and 24 deletions

View file

@ -527,23 +527,25 @@ void applyFixedWingNavigationController(navigationFSMStateFlags_t navStateFlags,
#ifdef NAV_FW_LIMIT_MIN_FLY_VELOCITY
// Don't apply anything if ground speed is too low (<3m/s)
if (posControl.actualState.velXY > 300) {
if (navStateFlags & NAV_CTL_ALT)
applyFixedWingAltitudeAndThrottleController(currentTimeUs);
#else
if (true) {
#endif
if (navStateFlags & NAV_CTL_ALT) {
if (getMotorStatus() == MOTOR_STOPPED_USER) {
// Motor has been stopped by user. Update target altitude and bypass navigation pitch/throttle control
resetFixedWingAltitudeController();
setDesiredPosition(&navGetCurrentActualPositionAndVelocity()->pos, posControl.actualState.yaw, NAV_POS_UPDATE_Z);
} else
applyFixedWingAltitudeAndThrottleController(currentTimeUs);
}
if (navStateFlags & NAV_CTL_POS)
applyFixedWingPositionController(currentTimeUs);
}
else {
} else {
posControl.rcAdjustment[PITCH] = 0;
posControl.rcAdjustment[ROLL] = 0;
}
#else
if (navStateFlags & NAV_CTL_ALT)
applyFixedWingAltitudeAndThrottleController(currentTimeUs);
if (navStateFlags & NAV_CTL_POS)
applyFixedWingPositionController(currentTimeUs);
#endif
//if (navStateFlags & NAV_CTL_YAW)
if ((navStateFlags & NAV_CTL_ALT) || (navStateFlags & NAV_CTL_POS))