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

Disable user-activated motor-stop if navigation system is in autonomous mode (RTH or WP)

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2017-10-05 22:37:47 +10:00
parent 0dfef47cea
commit 0778619547
3 changed files with 10 additions and 1 deletions

View file

@ -46,6 +46,8 @@
#include "flight/pid.h"
#include "flight/servos.h"
#include "navigation/navigation.h"
#include "rx/rx.h"
@ -564,7 +566,7 @@ void mixTable(void)
if (feature(FEATURE_MOTOR_STOP) && ARMING_FLAG(ARMED)) {
bool failsafeMotorStop = failsafeRequiresMotorStop();
bool navMotorStop = !failsafeIsActive() && STATE(NAV_MOTOR_STOP_OR_IDLE);
bool userMotorStop = !failsafeIsActive() && (rcData[THROTTLE] < rxConfig()->mincheck);
bool userMotorStop = !navigationIsFlyingAutonomousMode() && !failsafeIsActive() && (rcData[THROTTLE] < rxConfig()->mincheck);
if (failsafeMotorStop || navMotorStop || userMotorStop) {
if (feature(FEATURE_3D)) {
motor[i] = rxConfig()->midrc;

View file

@ -2699,6 +2699,12 @@ bool navigationIsControllingThrottle(void)
return (stateFlags & (NAV_CTL_ALT | NAV_CTL_EMERG | NAV_CTL_LAUNCH | NAV_CTL_LAND)) || (STATE(FIXED_WING) && (stateFlags & (NAV_CTL_POS)));
}
bool navigationIsFlyingAutonomousMode(void)
{
navigationFSMStateFlags_t stateFlags = navGetCurrentStateFlags();
return (stateFlags & (NAV_AUTO_RTH | NAV_AUTO_WP));
}
#else // NAV
#ifdef GPS

View file

@ -301,6 +301,7 @@ rthState_e getStateOfForcedRTH(void);
/* Getter functions which return data about the state of the navigation system */
bool navigationIsControllingThrottle(void);
bool navigationIsFlyingAutonomousMode(void);
/* Compatibility data */
extern navSystemStatus_t NAV_Status;