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:
parent
0dfef47cea
commit
0778619547
3 changed files with 10 additions and 1 deletions
|
@ -46,6 +46,8 @@
|
||||||
#include "flight/pid.h"
|
#include "flight/pid.h"
|
||||||
#include "flight/servos.h"
|
#include "flight/servos.h"
|
||||||
|
|
||||||
|
#include "navigation/navigation.h"
|
||||||
|
|
||||||
#include "rx/rx.h"
|
#include "rx/rx.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -564,7 +566,7 @@ void mixTable(void)
|
||||||
if (feature(FEATURE_MOTOR_STOP) && ARMING_FLAG(ARMED)) {
|
if (feature(FEATURE_MOTOR_STOP) && ARMING_FLAG(ARMED)) {
|
||||||
bool failsafeMotorStop = failsafeRequiresMotorStop();
|
bool failsafeMotorStop = failsafeRequiresMotorStop();
|
||||||
bool navMotorStop = !failsafeIsActive() && STATE(NAV_MOTOR_STOP_OR_IDLE);
|
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 (failsafeMotorStop || navMotorStop || userMotorStop) {
|
||||||
if (feature(FEATURE_3D)) {
|
if (feature(FEATURE_3D)) {
|
||||||
motor[i] = rxConfig()->midrc;
|
motor[i] = rxConfig()->midrc;
|
||||||
|
|
|
@ -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)));
|
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
|
#else // NAV
|
||||||
|
|
||||||
#ifdef GPS
|
#ifdef GPS
|
||||||
|
|
|
@ -301,6 +301,7 @@ rthState_e getStateOfForcedRTH(void);
|
||||||
|
|
||||||
/* Getter functions which return data about the state of the navigation system */
|
/* Getter functions which return data about the state of the navigation system */
|
||||||
bool navigationIsControllingThrottle(void);
|
bool navigationIsControllingThrottle(void);
|
||||||
|
bool navigationIsFlyingAutonomousMode(void);
|
||||||
|
|
||||||
/* Compatibility data */
|
/* Compatibility data */
|
||||||
extern navSystemStatus_t NAV_Status;
|
extern navSystemStatus_t NAV_Status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue