Copter: constrain throttle before setting deadband

This commit is contained in:
Ryan Birmingham 2021-03-09 23:32:53 -05:00 committed by Randy Mackay
parent aa75fc2c3d
commit c2cdb00f85

View File

@ -84,17 +84,17 @@ float Copter::get_pilot_desired_climb_rate(float throttle_control)
}
#endif
float desired_rate = 0.0f;
float mid_stick = get_throttle_mid();
float deadband_top = mid_stick + g.throttle_deadzone;
float deadband_bottom = mid_stick - g.throttle_deadzone;
// ensure a reasonable throttle value
throttle_control = constrain_float(throttle_control,0.0f,1000.0f);
// ensure a reasonable deadzone
g.throttle_deadzone = constrain_int16(g.throttle_deadzone, 0, 400);
float desired_rate = 0.0f;
const float mid_stick = get_throttle_mid();
const float deadband_top = mid_stick + g.throttle_deadzone;
const float deadband_bottom = mid_stick - g.throttle_deadzone;
// check throttle is above, below or in the deadband
if (throttle_control < deadband_bottom) {
// below the deadband