diff --git a/docs/Cli.md b/docs/Cli.md index a078a3fb69e..98ffaa7685b 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -163,6 +163,7 @@ Re-apply any new defaults as desired. | nav_land_slowdown_maxalt | 2000 | Defines at what altitude the descent velocity should start to ramp down from 100% nav_landing_speed to 25% nav_landing_speed. [cm] | | nav_emerg_landing_speed | 500 | Rate of descent UAV will try to maintain when doing emergency descent sequence [cm/s] | | nav_min_rth_distance | 500 | Minimum distance from homepoint when RTH full procedure will be activated [cm]. Below this distance, the mode will activate at the current location and the final phase is executed (loiter / land). Above this distance, the full procedure is activated, which may include initial climb and flying directly to the homepoint before entering the loiter / land phase. | +| nav_overrides_motor_stop | ON | Setting to OFF combined with MOTOR_STOP feature will allow user to stop motor when in autonomous modes. On most places this setting is likely to cause a stall. | | nav_rth_climb_first | ON | If set to ON drone will climb to nav_rth_altitude first and head home afterwards. If set to OFF drone will head home instantly and climb on the way. | | nav_rth_tail_first | OFF | If set to ON drone will return tail-first. Obviously meaningless for airplanes. | | nav_rth_allow_landing | ALWAYS | If set to ON drone will land as a last phase of RTH. | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 9f2b7439d13..903fe89fcc8 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1257,6 +1257,9 @@ groups: field: general.min_rth_distance min: 0 max: 5000 + - name: nav_overrides_motor_stop + field: general.flags.auto_overrides_motor_stop + type: bool - name: nav_rth_climb_first field: general.flags.rth_climb_first type: bool diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index a5a85ffc134..cad671c127d 100755 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -371,11 +371,15 @@ void mixTable(const float dT) motorStatus_e getMotorStatus(void) { - if (failsafeRequiresMotorStop() || (!failsafeIsActive() && STATE(NAV_MOTOR_STOP_OR_IDLE))) + if (failsafeRequiresMotorStop() || (!failsafeIsActive() && STATE(NAV_MOTOR_STOP_OR_IDLE))) { return MOTOR_STOPPED_AUTO; + } - if ((STATE(FIXED_WING) || !isAirmodeActive()) && (!navigationIsFlyingAutonomousMode()) && (!failsafeIsActive()) && (rcData[THROTTLE] < rxConfig()->mincheck)) - return MOTOR_STOPPED_USER; + if (rcData[THROTTLE] < rxConfig()->mincheck) { + if ((STATE(FIXED_WING) || !isAirmodeActive()) && (!(navigationIsFlyingAutonomousMode() && navConfig()->general.flags.auto_overrides_motor_stop)) && (!failsafeIsActive())) { + return MOTOR_STOPPED_USER; + } + } return MOTOR_RUNNING; } diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index f4f199db6f7..bf62392855b 100755 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -92,6 +92,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig, .rth_tail_first = 0, .disarm_on_landing = 0, .rth_allow_landing = NAV_RTH_ALLOW_LANDING_ALWAYS, + .auto_overrides_motor_stop = 1, }, // General navigation parameters diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index 28a2ef3523b..12aacd19ed8 100755 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -126,6 +126,7 @@ typedef struct navConfig_s { uint8_t disarm_on_landing; // uint8_t rth_allow_landing; // Enable landing as last stage of RTH. Use constants in navRTHAllowLanding_e. uint8_t rth_climb_ignore_emerg; // Option to ignore GPS loss on initial climb stage of RTH + uint8_t auto_overrides_motor_stop; // Autonomous modes override motor_stop setting and user command to stop motor } flags; uint8_t pos_failure_timeout; // Time to wait before switching to emergency landing (0 - disable)