mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 01:35:35 +03:00
NAV: Prevent switching to IDLE state on GPS loss - keep activated flight mode and give chance for EMERG controller to kick in. Emergency GPS timeout set to 5 seconds.
This commit is contained in:
parent
d26c8b0e01
commit
c8b7e8ae74
2 changed files with 8 additions and 7 deletions
|
@ -1970,7 +1970,7 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_RTH;
|
return NAV_FSM_EVENT_SWITCH_TO_RTH;
|
||||||
}
|
}
|
||||||
else if (IS_RC_MODE_ACTIVE(BOXNAVRTH)) {
|
else if (IS_RC_MODE_ACTIVE(BOXNAVRTH)) {
|
||||||
if (canActivatePosHold && STATE(GPS_FIX_HOME))
|
if ((FLIGHT_MODE(NAV_RTH_MODE)) || (canActivatePosHold && STATE(GPS_FIX_HOME)))
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_RTH;
|
return NAV_FSM_EVENT_SWITCH_TO_RTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1980,22 +1980,23 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RC_MODE_ACTIVE(BOXNAVWP)) {
|
if (IS_RC_MODE_ACTIVE(BOXNAVWP)) {
|
||||||
if (canActivatePosHold && canActivateAltHold && STATE(GPS_FIX_HOME) && ARMING_FLAG(ARMED) && posControl.waypointListValid && (posControl.waypointCount > 0))
|
if ((FLIGHT_MODE(NAV_WP_MODE)) || (canActivatePosHold && canActivateAltHold && STATE(GPS_FIX_HOME) && ARMING_FLAG(ARMED) && posControl.waypointListValid && (posControl.waypointCount > 0)))
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_WAYPOINT;
|
return NAV_FSM_EVENT_SWITCH_TO_WAYPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD) && IS_RC_MODE_ACTIVE(BOXNAVALTHOLD)) {
|
if (IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD) && IS_RC_MODE_ACTIVE(BOXNAVALTHOLD)) {
|
||||||
if (canActivatePosHold && canActivateAltHold)
|
if ((FLIGHT_MODE(NAV_ALTHOLD_MODE) && FLIGHT_MODE(NAV_POSHOLD_MODE)) || (canActivatePosHold && canActivateAltHold))
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_POSHOLD_3D;
|
return NAV_FSM_EVENT_SWITCH_TO_POSHOLD_3D;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD)) {
|
if (IS_RC_MODE_ACTIVE(BOXNAVPOSHOLD)) {
|
||||||
if (canActivatePosHold)
|
if ((FLIGHT_MODE(NAV_POSHOLD_MODE)) || (canActivatePosHold))
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_POSHOLD_2D;
|
return NAV_FSM_EVENT_SWITCH_TO_POSHOLD_2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RC_MODE_ACTIVE(BOXNAVALTHOLD) && canActivateAltHold) {
|
if (IS_RC_MODE_ACTIVE(BOXNAVALTHOLD)) {
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_ALTHOLD;
|
if ((FLIGHT_MODE(NAV_ALTHOLD_MODE)) || (canActivateAltHold))
|
||||||
|
return NAV_FSM_EVENT_SWITCH_TO_ALTHOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NAV_FSM_EVENT_SWITCH_TO_IDLE;
|
return NAV_FSM_EVENT_SWITCH_TO_IDLE;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#define DISTANCE_BETWEEN_TWO_LONGITUDE_POINTS_AT_EQUATOR 1.113195f // MagicEarthNumber from APM
|
#define DISTANCE_BETWEEN_TWO_LONGITUDE_POINTS_AT_EQUATOR 1.113195f // MagicEarthNumber from APM
|
||||||
|
|
||||||
#define LAND_DETECTOR_TRIGGER_TIME_MS 2000 // 2 seconds
|
#define LAND_DETECTOR_TRIGGER_TIME_MS 2000 // 2 seconds
|
||||||
#define NAV_WAIT_FOR_GPS_TIMEOUT_MS 2000 // GPS wait time-out
|
#define NAV_WAIT_FOR_GPS_TIMEOUT_MS 5000 // GPS wait time-out 5 sec
|
||||||
|
|
||||||
#define MIN_POSITION_UPDATE_RATE_HZ 5 // Minimum position update rate at which XYZ controllers would be applied
|
#define MIN_POSITION_UPDATE_RATE_HZ 5 // Minimum position update rate at which XYZ controllers would be applied
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue