Skip to content
Snippets Groups Projects
Commit 290cdcf6 authored by Randy Mackay's avatar Randy Mackay
Browse files

Copter: check fence when disarmed

this allows catching fence breaches as part of arming checks
parent fbe0e5df
No related branches found
No related tags found
No related merge requests found
...@@ -13,17 +13,17 @@ void Copter::fence_check() ...@@ -13,17 +13,17 @@ void Copter::fence_check()
uint8_t new_breaches; // the type of fence that has been breached uint8_t new_breaches; // the type of fence that has been breached
uint8_t orig_breaches = fence.get_breaches(); uint8_t orig_breaches = fence.get_breaches();
// return immediately if motors are not armed
if(!motors.armed()) {
return;
}
// give fence library our current distance from home in meters // give fence library our current distance from home in meters
fence.set_home_distance(home_distance*0.01f); fence.set_home_distance(home_distance*0.01f);
// check for a breach // check for a breach
new_breaches = fence.check_fence(current_loc.alt/100.0f); new_breaches = fence.check_fence(current_loc.alt/100.0f);
// return immediately if motors are not armed
if(!motors.armed()) {
return;
}
// if there is a new breach take action // if there is a new breach take action
if( new_breaches != AC_FENCE_TYPE_NONE ) { if( new_breaches != AC_FENCE_TYPE_NONE ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment