Sub: scale deadzone with gain

This commit is contained in:
Willian Galvani 2022-09-27 14:28:46 -03:00
parent 1b3cdc6442
commit b04a11ec95

View File

@ -100,7 +100,7 @@ float Sub::get_pilot_desired_climb_rate(float throttle_control)
// ensure a reasonable deadzone // ensure a reasonable deadzone
g.throttle_deadzone = constrain_int16(g.throttle_deadzone, 0, 400); g.throttle_deadzone = constrain_int16(g.throttle_deadzone, 0, 400);
uint16_t dead_zone = channel_throttle->get_dead_zone(); uint16_t dead_zone = channel_throttle->get_dead_zone() * gain;
uint16_t center = (channel_throttle->get_radio_max() + channel_throttle->get_radio_min())/2; uint16_t center = (channel_throttle->get_radio_max() + channel_throttle->get_radio_min())/2;
float throttle = throttle_control - center + 1000; float throttle = throttle_control - center + 1000;
if (abs(throttle) < dead_zone) { if (abs(throttle) < dead_zone) {