|
|
|
@ -43,13 +43,7 @@ void Plane::fence_check()
@@ -43,13 +43,7 @@ void Plane::fence_check()
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const bool current_mode_breach = plane.control_mode_reason == ModeReason::FENCE_BREACHED; |
|
|
|
|
const bool previous_mode_breach = plane.previous_mode_reason == ModeReason::FENCE_BREACHED; |
|
|
|
|
const bool previous_mode_complete = (plane.control_mode_reason == ModeReason::RTL_COMPLETE_SWITCHING_TO_VTOL_LAND_RTL) || |
|
|
|
|
(plane.control_mode_reason == ModeReason::RTL_COMPLETE_SWITCHING_TO_FIXEDWING_AUTOLAND) || |
|
|
|
|
(plane.control_mode_reason == ModeReason::QRTL_INSTEAD_OF_RTL) || |
|
|
|
|
(plane.control_mode_reason == ModeReason::QLAND_INSTEAD_OF_RTL); |
|
|
|
|
if (current_mode_breach || (previous_mode_breach && previous_mode_complete)) { |
|
|
|
|
if (in_fence_recovery()) { |
|
|
|
|
// we have already triggered, don't trigger again until the
|
|
|
|
|
// user disables/re-enables using the fence channel switch
|
|
|
|
|
return; |
|
|
|
@ -131,7 +125,7 @@ bool Plane::fence_stickmixing(void) const
@@ -131,7 +125,7 @@ bool Plane::fence_stickmixing(void) const
|
|
|
|
|
{ |
|
|
|
|
if (fence.enabled() && |
|
|
|
|
fence.get_breaches() && |
|
|
|
|
control_mode->is_guided_mode()) |
|
|
|
|
in_fence_recovery()) |
|
|
|
|
{ |
|
|
|
|
// don't mix in user input
|
|
|
|
|
return false; |
|
|
|
@ -140,4 +134,16 @@ bool Plane::fence_stickmixing(void) const
@@ -140,4 +134,16 @@ bool Plane::fence_stickmixing(void) const
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Plane::in_fence_recovery() const |
|
|
|
|
{ |
|
|
|
|
const bool current_mode_breach = plane.control_mode_reason == ModeReason::FENCE_BREACHED; |
|
|
|
|
const bool previous_mode_breach = plane.previous_mode_reason == ModeReason::FENCE_BREACHED; |
|
|
|
|
const bool previous_mode_complete = (plane.control_mode_reason == ModeReason::RTL_COMPLETE_SWITCHING_TO_VTOL_LAND_RTL) || |
|
|
|
|
(plane.control_mode_reason == ModeReason::RTL_COMPLETE_SWITCHING_TO_FIXEDWING_AUTOLAND) || |
|
|
|
|
(plane.control_mode_reason == ModeReason::QRTL_INSTEAD_OF_RTL) || |
|
|
|
|
(plane.control_mode_reason == ModeReason::QLAND_INSTEAD_OF_RTL); |
|
|
|
|
|
|
|
|
|
return current_mode_breach || (previous_mode_breach && previous_mode_complete); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|