mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
Be consistent in using #ifdef USE_SAFE_HOME
This commit is contained in:
parent
5d84300545
commit
77eb8e3518
2 changed files with 13 additions and 1 deletions
|
@ -1529,6 +1529,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef USE_SAFE_HOME
|
||||
static mspResult_e mspFcSafeHomeOutCommand(sbuf_t *dst, sbuf_t *src)
|
||||
{
|
||||
const uint8_t safe_home_no = sbufReadU8(src); // get the home number
|
||||
|
@ -1542,6 +1543,8 @@ static mspResult_e mspFcSafeHomeOutCommand(sbuf_t *dst, sbuf_t *src)
|
|||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static mspResult_e mspFcLogicConditionCommand(sbuf_t *dst, sbuf_t *src) {
|
||||
const uint8_t idx = sbufReadU8(src);
|
||||
|
@ -2919,6 +2922,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
return MSP_RESULT_ERROR; // will only be reached if the rollback is not ready
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_SAFE_HOME
|
||||
case MSP2_INAV_SET_SAFEHOME:
|
||||
if (dataSize == 10) {
|
||||
uint8_t i;
|
||||
|
@ -2932,6 +2936,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return MSP_RESULT_ERROR;
|
||||
|
@ -3377,9 +3382,11 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
|
|||
*ret = mspFcLogicConditionCommand(dst, src);
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_SAFE_HOME
|
||||
case MSP2_INAV_SAFEHOME:
|
||||
*ret = mspFcSafeHomeOutCommand(dst, src);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef USE_SIMULATOR
|
||||
case MSP_SIMULATOR:
|
||||
|
|
|
@ -3629,8 +3629,9 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
|
|||
const bool canActivatePosHold = canActivatePosHoldMode();
|
||||
const bool canActivateNavigation = canActivateNavigationModes();
|
||||
const bool isExecutingRTH = navGetStateFlags(posControl.navState) & NAV_AUTO_RTH;
|
||||
#ifdef USE_SAFE_HOME
|
||||
checkSafeHomeState(isExecutingRTH || posControl.flags.forcedRTHActivated);
|
||||
|
||||
#endif
|
||||
// deactivate rth trackback if RTH not active
|
||||
if (posControl.flags.rthTrackbackActive) {
|
||||
posControl.flags.rthTrackbackActive = isExecutingRTH;
|
||||
|
@ -4218,7 +4219,9 @@ void activateForcedRTH(void)
|
|||
{
|
||||
abortFixedWingLaunch();
|
||||
posControl.flags.forcedRTHActivated = true;
|
||||
#ifdef USE_SAFE_HOME
|
||||
checkSafeHomeState(true);
|
||||
#endif
|
||||
navProcessFSMEvents(selectNavEventFromBoxModeInput());
|
||||
}
|
||||
|
||||
|
@ -4227,7 +4230,9 @@ void abortForcedRTH(void)
|
|||
// Disable failsafe RTH and make sure we back out of navigation mode to IDLE
|
||||
// If any navigation mode was active prior to RTH it will be re-enabled with next RX update
|
||||
posControl.flags.forcedRTHActivated = false;
|
||||
#ifdef USE_SAFE_HOME
|
||||
checkSafeHomeState(false);
|
||||
#endif
|
||||
navProcessFSMEvents(NAV_FSM_EVENT_SWITCH_TO_IDLE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue