mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
Copter: check for fence breaches when disarmed
This commit is contained in:
parent
4d5e258b19
commit
75c2a2b02a
@ -8,16 +8,18 @@
|
|||||||
// called at 1hz
|
// called at 1hz
|
||||||
void Copter::fence_check()
|
void Copter::fence_check()
|
||||||
{
|
{
|
||||||
// ignore any fence activity when not armed
|
|
||||||
if(!motors->armed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t orig_breaches = fence.get_breaches();
|
const uint8_t orig_breaches = fence.get_breaches();
|
||||||
|
|
||||||
// check for new breaches; new_breaches is bitmask of fence types breached
|
// check for new breaches; new_breaches is bitmask of fence types breached
|
||||||
const uint8_t new_breaches = fence.check();
|
const uint8_t new_breaches = fence.check();
|
||||||
|
|
||||||
|
// 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 (!motors->armed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if there is a new breach take action
|
// if there is a new breach take action
|
||||||
if (new_breaches) {
|
if (new_breaches) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user