From 20debc962a8020ede50c7f7ca0dc485e84fb181e Mon Sep 17 00:00:00 2001 From: Leonard Hall Date: Mon, 4 Jan 2016 21:47:27 +1030 Subject: [PATCH] Copter: update get_throttle_pre_takeoff for 0 to 1 range --- ArduCopter/Attitude.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/ArduCopter/Attitude.cpp b/ArduCopter/Attitude.cpp index 96fc550c74..e42608cb1e 100644 --- a/ArduCopter/Attitude.cpp +++ b/ArduCopter/Attitude.cpp @@ -211,9 +211,8 @@ float Copter::get_takeoff_trigger_throttle() return channel_throttle->get_control_mid() + g.takeoff_trigger_dz; } -// get_throttle_pre_takeoff - convert pilot's input throttle to a throttle output before take-off +// get_throttle_pre_takeoff - convert pilot's input throttle to a throttle output (in the range 0 to 1) before take-off // used only for althold, loiter, hybrid flight modes -// returns throttle output 0 to 1000 float Copter::get_throttle_pre_takeoff(float input_thr) { // exit immediately if input_thr is zero @@ -221,19 +220,13 @@ float Copter::get_throttle_pre_takeoff(float input_thr) return 0.0f; } - // TODO: does this parameter sanity check really belong here? - g.throttle_mid = constrain_int16(g.throttle_mid,g.throttle_min+50,700); + // ensure reasonable throttle values + input_thr = constrain_float(input_thr,0.0f,1000.0f); - float in_min = g.throttle_min; + float in_min = 0.0f; float in_max = get_takeoff_trigger_throttle(); -#if FRAME_CONFIG == HELI_FRAME - // helicopters swash will move from bottom to 1/2 of mid throttle - float out_min = 0; -#else - // multicopters will output between spin-when-armed and 1/2 of mid throttle - float out_min = motors.get_throttle_warn(); -#endif + float out_min = 0.0f; float out_max = get_non_takeoff_throttle(); if ((g.throttle_behavior & THR_BEHAVE_FEEDBACK_FROM_MID_STICK) != 0) {