diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index f5201ccf891..fcb337081f9 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -1171,7 +1171,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_INITIALIZE(navigati if (STATE(FIXED_WING_LEGACY)) { // Airplane - climbout before heading home - if (navConfig()->general.flags.rth_climb_first == ON_FW_SPIRAL) { + if (navConfig()->general.flags.rth_climb_first == RTH_CLIMB_ON_FW_SPIRAL) { // Spiral climb centered at xy of RTH activation calculateInitialHoldPosition(&targetHoldPos); } else { @@ -1220,7 +1220,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_CLIMB_TO_SAFE_ALT(n const float rthAltitudeMargin = MAX(FW_RTH_CLIMB_MARGIN_MIN_CM, (rthClimbMarginPercent/100.0) * fabsf(posControl.rthState.rthInitialAltitude - posControl.rthState.homePosition.pos.z)); // If we reached desired initial RTH altitude or we don't want to climb first - if (((navGetCurrentActualPositionAndVelocity()->pos.z - posControl.rthState.rthInitialAltitude) > -rthAltitudeMargin) || (navConfig()->general.flags.rth_climb_first == OFF) || rthAltControlStickOverrideCheck(ROLL) || rthClimbStageActiveAndComplete()) { + if (((navGetCurrentActualPositionAndVelocity()->pos.z - posControl.rthState.rthInitialAltitude) > -rthAltitudeMargin) || (navConfig()->general.flags.rth_climb_first == RTH_CLIMB_OFF) || rthAltControlStickOverrideCheck(ROLL) || rthClimbStageActiveAndComplete()) { // Delayed initialization for RTH sanity check on airplanes - allow to finish climb first as it can take some distance if (STATE(FIXED_WING_LEGACY)) { @@ -1251,7 +1251,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_CLIMB_TO_SAFE_ALT(n // Climb to safe altitude and turn to correct direction if (STATE(FIXED_WING_LEGACY)) { - if (navConfig()->general.flags.rth_climb_first == ON_FW_SPIRAL) { + if (navConfig()->general.flags.rth_climb_first == RTH_CLIMB_ON_FW_SPIRAL) { float altitudeChangeDirection = (tmpHomePos->z += FW_RTH_CLIMB_OVERSHOOT_CM) > navGetCurrentActualPositionAndVelocity()->pos.z ? 1 : -1; updateClimbRateToAltitudeController(altitudeChangeDirection * navConfig()->general.max_auto_climb_rate, ROC_TO_ALT_NORMAL); } else { diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index ac91fe79f79..84e64c1c5bb 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -140,9 +140,9 @@ typedef enum { } navOverridesMotorStop_e; typedef enum { - OFF, - ON, - ON_FW_SPIRAL, + RTH_CLIMB_OFF, + RTH_CLIMB_ON, + RTH_CLIMB_ON_FW_SPIRAL, } navRTHClimbFirst_e; typedef enum { // keep aligned with fixedWingLaunchState_t