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
This commit is contained in:
Tom Pittenger 2016-04-19 15:41:02 -07:00
parent ec3e9014e4
commit 6a83ad419a
3 changed files with 5 additions and 2 deletions

View File

@ -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()

View File

@ -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

View File

@ -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);