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

Merge pull request #3298 from shellixyz/disable_althold_on_zero_throttle

Disable ALTHOLD on user motor stop request
This commit is contained in:
Alberto García Hierro 2018-06-18 17:03:26 +01:00 committed by GitHub
commit 3e18c56c17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 23 deletions

View file

@ -532,23 +532,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 (FLIGHT_MODE(NAV_CRUISE_MODE) && posControl.flags.isAdjustingPosition)
rcCommand[ROLL] = applyDeadband(rcCommand[ROLL], rcControlsConfig()->pos_hold_deadband);