mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-20 06:45:14 +03:00
Make nav_overrides_motor_stop tristate: OFF | AUTO_ONLY | ALL_NAV
This commit is contained in:
parent
ab051b18c7
commit
20efd8939c
4 changed files with 19 additions and 8 deletions
|
@ -149,6 +149,9 @@ tables:
|
||||||
values: ["TYPE1", "TYPE2"]
|
values: ["TYPE1", "TYPE2"]
|
||||||
- name: off_on
|
- name: off_on
|
||||||
values: ["OFF", "ON"]
|
values: ["OFF", "ON"]
|
||||||
|
- name: nav_overrides_motor_stop
|
||||||
|
enum: navOverridesMotorStop_e
|
||||||
|
values: ["OFF", "AUTO_ONLY", "ALL_NAV"]
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
- name: PG_GYRO_CONFIG
|
- name: PG_GYRO_CONFIG
|
||||||
|
@ -2101,10 +2104,10 @@ groups:
|
||||||
min: 0
|
min: 0
|
||||||
max: 5000
|
max: 5000
|
||||||
- name: nav_overrides_motor_stop
|
- name: nav_overrides_motor_stop
|
||||||
description: "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."
|
description: "When set OFF the navigation system will not take over the control of the motor if the throttle is low (motor will stop). When set to AUTO_ONLY the navigation system will only take over the control of the throttle in autonomous navigation modes (NAV WP and NAV RTH). When set to ALL_NAV (default) the navigation system will take over the control of the motor completely and never allow the motor to stop even when the throttle is low. This setting only has an effect combined with MOTOR_STOP and is likely to cause a stall if fw_min_throttle_down_pitch isn't set correctly or the pitch estimation is wrong for fixed wing models when not set to ALL_NAV"
|
||||||
default_value: "ON"
|
default_value: "NOMS_ALL_NAV"
|
||||||
field: general.flags.auto_overrides_motor_stop
|
field: general.flags.nav_overrides_motor_stop
|
||||||
type: bool
|
table: nav_overrides_motor_stop
|
||||||
- name: nav_rth_climb_first
|
- name: nav_rth_climb_first
|
||||||
description: "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."
|
description: "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."
|
||||||
default_value: "ON"
|
default_value: "ON"
|
||||||
|
|
|
@ -579,7 +579,9 @@ motorStatus_e getMotorStatus(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calculateThrottleStatus(feature(FEATURE_REVERSIBLE_MOTORS) ? THROTTLE_STATUS_TYPE_COMMAND : THROTTLE_STATUS_TYPE_RC) == THROTTLE_LOW) {
|
if (calculateThrottleStatus(feature(FEATURE_REVERSIBLE_MOTORS) ? THROTTLE_STATUS_TYPE_COMMAND : THROTTLE_STATUS_TYPE_RC) == THROTTLE_LOW) {
|
||||||
if ((STATE(FIXED_WING_LEGACY) || !STATE(AIRMODE_ACTIVE)) && (!(navigationIsFlyingAutonomousMode() && navConfig()->general.flags.auto_overrides_motor_stop)) && (!failsafeIsActive())) {
|
navOverridesMotorStop_e motorStopOverride = navConfig()->general.flags.nav_overrides_motor_stop;
|
||||||
|
if (!failsafeIsActive() && (STATE(FIXED_WING_LEGACY) || !STATE(AIRMODE_ACTIVE)) &&
|
||||||
|
((motorStopOverride == NOMS_OFF) || ((motorStopOverride == NOMS_ALL_NAV) && !navigationIsControllingThrottle()) || ((motorStopOverride == NOMS_AUTO_ONLY) && !navigationIsFlyingAutonomousMode()))) {
|
||||||
return MOTOR_STOPPED_USER;
|
return MOTOR_STOPPED_USER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ PG_REGISTER_ARRAY(navSafeHome_t, MAX_SAFE_HOMES, safeHomeConfig, PG_SAFE_HOME_CO
|
||||||
PG_REGISTER_ARRAY(navWaypoint_t, NAV_MAX_WAYPOINTS, nonVolatileWaypointList, PG_WAYPOINT_MISSION_STORAGE, 0);
|
PG_REGISTER_ARRAY(navWaypoint_t, NAV_MAX_WAYPOINTS, nonVolatileWaypointList, PG_WAYPOINT_MISSION_STORAGE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 7);
|
PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 8);
|
||||||
|
|
||||||
PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
||||||
.general = {
|
.general = {
|
||||||
|
@ -102,7 +102,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
||||||
.rth_tail_first = 0,
|
.rth_tail_first = 0,
|
||||||
.disarm_on_landing = 0,
|
.disarm_on_landing = 0,
|
||||||
.rth_allow_landing = NAV_RTH_ALLOW_LANDING_ALWAYS,
|
.rth_allow_landing = NAV_RTH_ALLOW_LANDING_ALWAYS,
|
||||||
.auto_overrides_motor_stop = 1,
|
.nav_overrides_motor_stop = NOMS_ALL_NAV,
|
||||||
},
|
},
|
||||||
|
|
||||||
// General navigation parameters
|
// General navigation parameters
|
||||||
|
|
|
@ -124,6 +124,12 @@ typedef enum {
|
||||||
NAV_ARMING_BLOCKER_JUMP_WAYPOINT_ERROR = 4,
|
NAV_ARMING_BLOCKER_JUMP_WAYPOINT_ERROR = 4,
|
||||||
} navArmingBlocker_e;
|
} navArmingBlocker_e;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NOMS_OFF,
|
||||||
|
NOMS_AUTO_ONLY,
|
||||||
|
NOMS_ALL_NAV
|
||||||
|
} navOverridesMotorStop_e;
|
||||||
|
|
||||||
typedef struct positionEstimationConfig_s {
|
typedef struct positionEstimationConfig_s {
|
||||||
uint8_t automatic_mag_declination;
|
uint8_t automatic_mag_declination;
|
||||||
uint8_t reset_altitude_type; // from nav_reset_type_e
|
uint8_t reset_altitude_type; // from nav_reset_type_e
|
||||||
|
@ -175,7 +181,7 @@ typedef struct navConfig_s {
|
||||||
uint8_t disarm_on_landing; //
|
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_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 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
|
uint8_t nav_overrides_motor_stop; // Autonomous modes override motor_stop setting and user command to stop motor
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
uint8_t pos_failure_timeout; // Time to wait before switching to emergency landing (0 - disable)
|
uint8_t pos_failure_timeout; // Time to wait before switching to emergency landing (0 - disable)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue