From 3d024ba2dd7ecbc711800d911b219cde7c1c1d55 Mon Sep 17 00:00:00 2001 From: Adam M Rivera Date: Mon, 16 Apr 2012 10:11:50 -0500 Subject: [PATCH] commands_logic: Allowed for an approach alt as low as 1m. Added a check to make sure we are currently above our target approach alt. --- ArduCopter/commands_logic.pde | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ArduCopter/commands_logic.pde b/ArduCopter/commands_logic.pde index 327686cfb6..1ac9b2cb13 100644 --- a/ArduCopter/commands_logic.pde +++ b/ArduCopter/commands_logic.pde @@ -294,8 +294,9 @@ static void do_land() static void do_approach() { - // Make sure we are not using this to land - if(g.rtl_approach_alt >= 5){ + uint16_t target_alt = (uint16_t)(constrain((float)g.rtl_approach_alt, 1, 10) * 100); + // Make sure we are not using this to land and that we are currently above the target approach alt + if(g.rtl_approach_alt >= 1 && current_loc.alt > target_alt){ wp_control = LOITER_MODE; // just to make sure @@ -312,7 +313,7 @@ static void do_approach() set_next_WP(¤t_loc); // Set target alt based on user setting - set_new_altitude(g.rtl_approach_alt * 100); + set_new_altitude(target_alt); } else { set_mode(LOITER); }