mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 00:05:28 +03:00
[NAV/MIXER] Refactor getMotorStop() code; Avoid recursion and crash when nav_overrides_motor_stop is set to NOMS_ALL_NAV
This commit is contained in:
parent
4c483895cd
commit
94332bc286
4 changed files with 33 additions and 8 deletions
|
@ -3649,10 +3649,16 @@ bool navigationIsExecutingAnEmergencyLanding(void)
|
|||
return navGetCurrentStateFlags() & NAV_CTL_EMERG;
|
||||
}
|
||||
|
||||
bool navigationIsControllingThrottle(void)
|
||||
bool navigationInAutomaticThrottleMode(void)
|
||||
{
|
||||
navigationFSMStateFlags_t stateFlags = navGetCurrentStateFlags();
|
||||
return ((stateFlags & (NAV_CTL_ALT | NAV_CTL_EMERG | NAV_CTL_LAUNCH | NAV_CTL_LAND)) && (getMotorStatus() != MOTOR_STOPPED_USER));
|
||||
return (stateFlags & (NAV_CTL_ALT | NAV_CTL_EMERG | NAV_CTL_LAUNCH | NAV_CTL_LAND));
|
||||
}
|
||||
|
||||
bool navigationIsControllingThrottle(void)
|
||||
{
|
||||
// Note that this makes a detour into mixer code to evaluate actual motor status
|
||||
return navigationInAutomaticThrottleMode() && (getMotorStatus() != MOTOR_STOPPED_USER);
|
||||
}
|
||||
|
||||
bool navigationIsFlyingAutonomousMode(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue