1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-20 14:55:18 +03:00

Update navigation.c

Fix tabs
This commit is contained in:
breadoven 2020-11-17 22:10:27 +00:00
parent 8f2c2620ef
commit 011533be52

View file

@ -106,7 +106,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
.rth_tail_first = 0,
.disarm_on_landing = 0,
.rth_allow_landing = NAV_RTH_ALLOW_LANDING_ALWAYS,
.rth_alt_control_override = 0, //set using nav_rth_alt_control_override
.rth_alt_control_override = 0, //Override the preset RTH altitude to the current altitude
.nav_overrides_motor_stop = NOMS_ALL_NAV,
},
@ -2520,22 +2520,22 @@ static void overrideRTHAtitudePreset(void)
return;
}
static timeMs_t PitchStickHoldStartTime;
static timeMs_t PitchStickHoldStartTime;
if (rxGetChannelValue(PITCH) > 1900) {
if (!PitchStickHoldStartTime) {
PitchStickHoldStartTime = millis();
} else {
timeMs_t currentTime = millis();
if (currentTime - PitchStickHoldStartTime > 1000 && !posControl.flags.forcedRTHActivated) {
posControl.rthState.rthInitialAltitude = posControl.actualState.abs.pos.z;
posControl.rthState.rthFinalAltitude = posControl.rthState.rthInitialAltitude;
}
}
} else {
PitchStickHoldStartTime = 0;
}
DEBUG_SET(DEBUG_CRUISE, 1, PitchStickHoldStartTime);
if (rxGetChannelValue(PITCH) > 1900) {
if (!PitchStickHoldStartTime) {
PitchStickHoldStartTime = millis();
} else {
timeMs_t currentTime = millis();
if (currentTime - PitchStickHoldStartTime > 1000 && !posControl.flags.forcedRTHActivated) {
posControl.rthState.rthInitialAltitude = posControl.actualState.abs.pos.z;
posControl.rthState.rthFinalAltitude = posControl.rthState.rthInitialAltitude;
}
}
} else {
PitchStickHoldStartTime = 0;
}
DEBUG_SET(DEBUG_CRUISE, 1, PitchStickHoldStartTime);
}
/*-----------------------------------------------------------