From 290cdcf6fb03963f0ce259ffd099c40ea647371b Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 8 Jul 2015 15:21:31 +0900 Subject: [PATCH] Copter: check fence when disarmed this allows catching fence breaches as part of arming checks --- ArduCopter/fence.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArduCopter/fence.cpp b/ArduCopter/fence.cpp index 5d306f9aa5..3baa7443a1 100644 --- a/ArduCopter/fence.cpp +++ b/ArduCopter/fence.cpp @@ -13,17 +13,17 @@ void Copter::fence_check() uint8_t new_breaches; // the type of fence that has been breached 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 fence.set_home_distance(home_distance*0.01f); // check for a breach 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( new_breaches != AC_FENCE_TYPE_NONE ) {