mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-17 13:25:27 +03:00
Update navigation.c
Reduced stick hold delay time to 1s and limited climb first override to fixed wing only
This commit is contained in:
parent
2a01175e0e
commit
e8dc880b5c
1 changed files with 5 additions and 6 deletions
|
@ -2454,24 +2454,23 @@ void updateHomePosition(void)
|
||||||
|
|
||||||
/* -----------------------------------------------------------
|
/* -----------------------------------------------------------
|
||||||
* Override RTH preset altitude and Climb First option
|
* Override RTH preset altitude and Climb First option
|
||||||
* using Pitch/Roll stick held for > 2 seconds
|
* using Pitch/Roll stick held for > 1 seconds
|
||||||
|
* Climb First override limited to Fixed Wing only
|
||||||
*-----------------------------------------------------------*/
|
*-----------------------------------------------------------*/
|
||||||
static bool rthAltControlStickOverrideCheck(unsigned axis)
|
static bool rthAltControlStickOverrideCheck(unsigned axis)
|
||||||
{
|
{
|
||||||
if (!navConfig()->general.flags.rth_alt_control_override || posControl.flags.forcedRTHActivated) {
|
if (!navConfig()->general.flags.rth_alt_control_override || posControl.flags.forcedRTHActivated || (axis == ROLL && STATE(MULTIROTOR))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static timeMs_t rthOverrideStickHoldStartTime[2];
|
static timeMs_t rthOverrideStickHoldStartTime[2];
|
||||||
|
|
||||||
if (rxGetChannelValue(axis) > rxConfig()->maxcheck) {
|
if (rxGetChannelValue(axis) > rxConfig()->maxcheck) {
|
||||||
|
|
||||||
timeDelta_t holdTime = millis() - rthOverrideStickHoldStartTime[axis];
|
timeDelta_t holdTime = millis() - rthOverrideStickHoldStartTime[axis];
|
||||||
|
|
||||||
if (!rthOverrideStickHoldStartTime[axis]) {
|
if (!rthOverrideStickHoldStartTime[axis]) {
|
||||||
rthOverrideStickHoldStartTime[axis] = millis();
|
rthOverrideStickHoldStartTime[axis] = millis();
|
||||||
} else if (ABS(2500 - holdTime) < 500) { // 2s delay to activate, activation duration limited to 1 sec
|
} else if (ABS(1500 - holdTime) < 500) { // 1s delay to activate, activation duration limited to 1 sec
|
||||||
if (axis == PITCH) { // PITCH down to override preset altitude reset to current altitude
|
if (axis == PITCH) { // PITCH down to override preset altitude reset to current altitude
|
||||||
posControl.rthState.rthInitialAltitude = posControl.actualState.abs.pos.z;
|
posControl.rthState.rthInitialAltitude = posControl.actualState.abs.pos.z;
|
||||||
posControl.rthState.rthFinalAltitude = posControl.rthState.rthInitialAltitude;
|
posControl.rthState.rthFinalAltitude = posControl.rthState.rthInitialAltitude;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue