Skip to content

Commit

Permalink
Copter: check for fence breaches when disarmed
Browse files Browse the repository at this point in the history
  • Loading branch information
chobitsfan committed May 29, 2018
1 parent 9dee2c4 commit ced830a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ArduCopter/fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
// called at 1hz
void Copter::fence_check()
{
// ignore any fence activity when not armed
if(!motors->armed()) {
return;
}

const uint8_t orig_breaches = fence.get_breaches();

// check for new breaches; new_breaches is bitmask of fence types breached
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 (new_breaches) {

Expand Down

0 comments on commit ced830a

Please sign in to comment.