diff --git a/ArduCopter/mode.h b/ArduCopter/mode.h index e77e10971e..b53fbaec4d 100644 --- a/ArduCopter/mode.h +++ b/ArduCopter/mode.h @@ -52,8 +52,6 @@ public: float descent_max_cm; private: - void run_hover(); - void run_descent(); uint32_t descent_established_time_ms; // milliseconds uint32_t place_start_time_ms; // milliseconds diff --git a/ArduCopter/mode_auto.cpp b/ArduCopter/mode_auto.cpp index 740b7cae70..d7e18e91fb 100644 --- a/ArduCopter/mode_auto.cpp +++ b/ArduCopter/mode_auto.cpp @@ -1357,38 +1357,26 @@ void PayloadPlace::run() return copter.mode_auto.wp_run(); case State::Descent_Start: case State::Descent: - return run_descent(); + copter.flightmode->land_run_horizontal_control(); + // update altitude target and call position controller + pos_control->land_at_climb_rate_cm(-descent_speed_cms, true); + pos_control->update_z_controller(); + return; case State::Release: case State::Releasing: case State::Delay: case State::Ascent_Start: - return run_hover(); + copter.flightmode->land_run_horizontal_control(); + // update altitude target and call position controller + pos_control->land_at_climb_rate_cm(0.0, false); + pos_control->update_z_controller(); + return; case State::Ascent: case State::Done: return copter.mode_auto.takeoff_run(); } } -void PayloadPlace::run_hover() -{ - const auto &pos_control = copter.pos_control; - - copter.flightmode->land_run_horizontal_control(); - // update altitude target and call position controller - pos_control->land_at_climb_rate_cm(0.0, false); - pos_control->update_z_controller(); -} - -void PayloadPlace::run_descent() -{ - const auto &pos_control = copter.pos_control; - - copter.flightmode->land_run_horizontal_control(); - // update altitude target and call position controller - pos_control->land_at_climb_rate_cm(-descent_speed_cms, true); - pos_control->update_z_controller(); -} - // sets the target_loc's alt to the vehicle's current alt but does not change target_loc's frame // in the case of terrain altitudes either the terrain database or the rangefinder may be used // returns true on success, false on failure