From 6a83ad419a535d6fce58f4d6a864e765a61c1013 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Tue, 19 Apr 2016 15:41:02 -0700 Subject: [PATCH] Plane: moved update_flight_stage() inside setup_glide_slope() the glide_slope gets calculated every time there's a major event such as mission item change or wp_proportion change so its good to update the flight stage then too because. also logging stage when stage changes, might as well get an extra data point in there when it's timely --- ArduPlane/ArduPlane.cpp | 4 ++++ ArduPlane/altitude.cpp | 1 + ArduPlane/commands_logic.cpp | 2 -- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ArduPlane/ArduPlane.cpp b/ArduPlane/ArduPlane.cpp index 835e53a265..3578007929 100644 --- a/ArduPlane/ArduPlane.cpp +++ b/ArduPlane/ArduPlane.cpp @@ -839,6 +839,10 @@ void Plane::set_flight_stage(AP_SpdHgtControl::FlightStage fs) flight_stage = fs; + + if (should_log(MASK_LOG_MODE)) { + Log_Write_Status(); + } } void Plane::update_alt() diff --git a/ArduPlane/altitude.cpp b/ArduPlane/altitude.cpp index 7dc4112a86..21f2ff5503 100644 --- a/ArduPlane/altitude.cpp +++ b/ArduPlane/altitude.cpp @@ -66,6 +66,7 @@ void Plane::setup_glide_slope(void) auto_state.wp_proportion = location_path_proportion(current_loc, prev_WP_loc, next_WP_loc); SpdHgt_Controller->set_path_proportion(auto_state.wp_proportion); + update_flight_stage(); /* work out if we will gradually change altitude, or try to get to diff --git a/ArduPlane/commands_logic.cpp b/ArduPlane/commands_logic.cpp index 813e5ccac9..fb648692b6 100644 --- a/ArduPlane/commands_logic.cpp +++ b/ArduPlane/commands_logic.cpp @@ -337,7 +337,6 @@ void Plane::do_RTL(void) loiter.direction = 1; } - update_flight_stage(); setup_glide_slope(); setup_turn_angle(); @@ -1008,7 +1007,6 @@ void Plane::exit_mission_callback() rally.calc_best_rally_or_home_location(current_loc, get_RTL_altitude()); auto_rtl_command.id = MAV_CMD_NAV_LOITER_UNLIM; setup_terrain_target_alt(auto_rtl_command.content.location); - update_flight_stage(); setup_glide_slope(); setup_turn_angle(); start_command(auto_rtl_command);