Copter: move set_throttle_takeoff implementation into Mode

No callers except the mode objects, so move it.
This commit is contained in:
Peter Barker 2020-06-16 16:38:36 +10:00 committed by Randy Mackay
parent 4e12f16608
commit d87986ecdd
4 changed files with 5 additions and 10 deletions

View File

@ -69,13 +69,6 @@ void Copter::update_throttle_hover()
#endif
}
// set_throttle_takeoff - allows parents to tell throttle controller we are taking off so I terms can be cleared
void Copter::set_throttle_takeoff()
{
// tell position controller to reset alt target and reset I terms
pos_control->init_takeoff();
}
// get_pilot_desired_climb_rate - transform pilot's throttle input to climb rate in cm/s
// without any deadzone at the bottom
float Copter::get_pilot_desired_climb_rate(float throttle_control)

View File

@ -661,7 +661,6 @@ private:
// Attitude.cpp
float get_pilot_desired_yaw_rate(int16_t stick_angle);
void update_throttle_hover();
void set_throttle_takeoff();
float get_pilot_desired_climb_rate(float throttle_control);
float get_non_takeoff_throttle();
float get_avoidance_adjusted_climbrate(float target_rate);

View File

@ -796,9 +796,12 @@ GCS_Copter &Mode::gcs()
return copter.gcs();
}
// set_throttle_takeoff - allows modes to tell throttle controller we
// are taking off so I terms can be cleared
void Mode::set_throttle_takeoff()
{
return copter.set_throttle_takeoff();
// tell position controller to reset alt target and reset I terms
pos_control->init_takeoff();
}
float Mode::get_avoidance_adjusted_climbrate(float target_rate)

View File

@ -54,7 +54,7 @@ void Mode::_TakeOff::start(float alt_cm)
// indicate we are taking off
copter.set_land_complete(false);
// tell position controller to reset alt target and reset I terms
copter.set_throttle_takeoff();
copter.flightmode->set_throttle_takeoff();
// calculate climb rate
const float speed = MIN(copter.wp_nav->get_default_speed_up(), MAX(copter.g.pilot_speed_up*2.0f/3.0f, copter.g.pilot_speed_up-50.0f));