mirror of https://github.com/ArduPilot/ardupilot
Plane: reset previous mode fence breach when disarmed
when we are disarmed or we are not in fence breach and we are not flying then reset the previous mode fence reason state so that a new flight will get the correct fence breach action behaviour
This commit is contained in:
parent
68f2593089
commit
5d46e0c64e
|
@ -39,10 +39,23 @@ void Plane::fence_check()
|
|||
return;
|
||||
}
|
||||
|
||||
const bool armed = arming.is_armed();
|
||||
|
||||
/*
|
||||
if we are either disarmed or we are currently not in breach and
|
||||
we are not flying then clear the state associated with the
|
||||
previous mode breach handling. This allows the fence state
|
||||
machine to reset at the end of a fence breach action such as an
|
||||
RTL and autoland
|
||||
*/
|
||||
if (!armed || (new_breaches == 0 && !plane.is_flying())) {
|
||||
plane.previous_mode_reason = ModeReason::UNKNOWN;
|
||||
}
|
||||
|
||||
// we still don't do anything when disarmed, but we do check for fence breaches.
|
||||
// fence pre-arm check actually checks if any fence has been breached
|
||||
// that's not ever going to be true if we don't call check on AP_Fence while disarmed
|
||||
if (!arming.is_armed()) {
|
||||
if (!armed) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue