Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copter: check for fence breaches when disarmed #8264

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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