1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 01:35:35 +03:00

Add trackback suspend + vibration warning

This commit is contained in:
breadoven 2023-02-18 13:14:05 +00:00
parent a5e2550193
commit 36caed01ab
6 changed files with 40 additions and 17 deletions

View file

@ -36,6 +36,7 @@
#include "fc/fc_core.h"
#include "fc/config.h"
#include "fc/multifunction.h"
#include "fc/rc_controls.h"
#include "fc/rc_modes.h"
#include "fc/runtime_config.h"
@ -1312,7 +1313,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_TRACKBACK(navigatio
if (posControl.flags.estPosStatus >= EST_USABLE) {
const int32_t distFromStartTrackback = calculateDistanceToDestination(&posControl.rthTBPointsList[posControl.rthTBLastSavedIndex]) / 100;
const bool cancelTrackback = distFromStartTrackback > navConfig()->general.rth_trackback_distance ||
(rthAltControlStickOverrideCheck(ROLL) && !posControl.flags.forcedRTHActivated);
((rthAltControlStickOverrideCheck(ROLL) || MULTI_FUNC_FLAG(SUSPEND_TRACKBACK)) && !posControl.flags.forcedRTHActivated);
if (posControl.activeRthTBPointIndex < 0 || cancelTrackback) {
posControl.rthTBWrapAroundCounter = posControl.activeRthTBPointIndex = -1;
@ -2456,16 +2457,10 @@ static navigationHomeFlags_t navigationActualStateHomeValidity(void)
}
#if defined(USE_SAFE_HOME)
void suspendSafehome(void)
{
// toggle Safehome suspend each call
posControl.safehomeState.isSuspended = !posControl.safehomeState.isSuspended;
}
void checkSafeHomeState(bool shouldBeEnabled)
{
const bool safehomeNotApplicable = navConfig()->general.flags.safehome_usage_mode == SAFEHOME_USAGE_OFF ||
posControl.safehomeState.isSuspended ||
(MULTI_FUNC_FLAG(SUSPEND_SAFEHOMES) && !posControl.flags.forcedRTHActivated) ||
posControl.flags.rthTrackbackActive ||
(!posControl.safehomeState.isApplied && posControl.homeDistance < navConfig()->general.min_rth_distance);