mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 16:25:26 +03:00
Correct RTH initial climb end condition.
This commit is contained in:
parent
38a765e076
commit
3e7c6de226
1 changed files with 2 additions and 2 deletions
|
@ -861,8 +861,8 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_CLIMB_TO_SAFE_ALT(n
|
||||||
// If we have valid pos sensor OR we are configured to ignore GPS loss
|
// If we have valid pos sensor OR we are configured to ignore GPS loss
|
||||||
if (posControl.flags.hasValidPositionSensor || !checkForPositionSensorTimeout() || navConfig()->general.flags.rth_climb_ignore_emerg) {
|
if (posControl.flags.hasValidPositionSensor || !checkForPositionSensorTimeout() || navConfig()->general.flags.rth_climb_ignore_emerg) {
|
||||||
const float rthAltitudeMargin = STATE(FIXED_WING) ?
|
const float rthAltitudeMargin = STATE(FIXED_WING) ?
|
||||||
MIN(100.0f, 0.10f * ABS(posControl.homeWaypointAbove.pos.V.Z - posControl.homePosition.pos.V.Z)) : // Airplane: 10% of target altitude but no less than 1m
|
MAX(100.0f, 0.10f * ABS(posControl.homeWaypointAbove.pos.V.Z - posControl.homePosition.pos.V.Z)) : // Airplane: 10% of target altitude but no less than 1m
|
||||||
MIN( 50.0f, 0.05f * ABS(posControl.homeWaypointAbove.pos.V.Z - posControl.homePosition.pos.V.Z)); // Copters: 5% of target altitude but no less than 50cm
|
MAX( 50.0f, 0.05f * ABS(posControl.homeWaypointAbove.pos.V.Z - posControl.homePosition.pos.V.Z)); // Copters: 5% of target altitude but no less than 50cm
|
||||||
|
|
||||||
if (((posControl.actualState.pos.V.Z - posControl.homeWaypointAbove.pos.V.Z) > -rthAltitudeMargin) || (!navConfig()->general.flags.rth_climb_first)) {
|
if (((posControl.actualState.pos.V.Z - posControl.homeWaypointAbove.pos.V.Z) > -rthAltitudeMargin) || (!navConfig()->general.flags.rth_climb_first)) {
|
||||||
// Delayed initialization for RTH sanity check on airplanes - allow to finish climb first as it can take some distance
|
// Delayed initialization for RTH sanity check on airplanes - allow to finish climb first as it can take some distance
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue