From 5d28e973397ced2354c1877d89c16605be396426 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Mon, 9 Jan 2012 16:55:51 -0800 Subject: [PATCH] Moved failsafe check to more logical place --- ArduCopter/radio.pde | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ArduCopter/radio.pde b/ArduCopter/radio.pde index 79c0631e7b..e9233babb2 100644 --- a/ArduCopter/radio.pde +++ b/ArduCopter/radio.pde @@ -153,12 +153,16 @@ static void throttle_failsafe(uint16_t pwm) // throttle has dropped below the mark failsafeCounter++; if (failsafeCounter == 9){ - SendDebug("MSG FS ON "); - SendDebugln(pwm, DEC); + // }else if(failsafeCounter == 10) { // Don't enter Failsafe if we are not armed - if(motor_armed == true) + // home distance is in meters + // This is to prevent accidental RTL + if((motor_armed == true) && (home_distance > 10) && (current_loc.alt > 400)){ + SendDebug("MSG FS ON "); + SendDebugln(pwm, DEC); set_failsafe(true); + } }else if (failsafeCounter > 10){ failsafeCounter = 11; }