commands_logic: Added check to make sure the do_approach method is not being used to land.

This commit is contained in:
Adam M Rivera 2012-04-15 16:57:49 -05:00
parent 70d67b0791
commit 0027c9253b
1 changed files with 17 additions and 12 deletions

View File

@ -294,23 +294,28 @@ static void do_land()
static void do_approach() static void do_approach()
{ {
wp_control = LOITER_MODE; // Make sure we are not using this to land
if(g.rtl_approach_alt > 5){
wp_control = LOITER_MODE;
// just to make sure // just to make sure
land_complete = false; land_complete = false;
// landing boost lowers the main throttle to mimmick // landing boost lowers the main throttle to mimmick
// the effect of a user's hand // the effect of a user's hand
landing_boost = 0; landing_boost = 0;
// A counter that goes up if our climb rate stalls out. // A counter that goes up if our climb rate stalls out.
ground_detector = 0; ground_detector = 0;
// hold at our current location // hold at our current location
set_next_WP(&current_loc); set_next_WP(&current_loc);
// Set target alt based on user setting // Set target alt based on user setting
set_new_altitude(g.rtl_approach_alt * 100); set_new_altitude(g.rtl_approach_alt * 100);
} else {
set_mode(LOITER);
}
} }
static void do_loiter_unlimited() static void do_loiter_unlimited()