forked from Archive/PX4-Autopilot
rc_update: throttle trim centering fix for reverse channel
The entire logic did not work for the case when the throttle channel is reversed because then QGC sets trim = max for that channel and the result is only half the throttle range.
This commit is contained in:
parent
7cbf720d26
commit
f34fbdf0d3
|
@ -210,8 +210,12 @@ void RCUpdate::parameters_updated()
|
|||
const uint16_t throttle_min = _parameters.min[throttle_channel];
|
||||
const uint16_t throttle_trim = _parameters.trim[throttle_channel];
|
||||
const uint16_t throttle_max = _parameters.max[throttle_channel];
|
||||
const bool throttle_rev = _parameters.rev[throttle_channel];
|
||||
|
||||
if (throttle_min == throttle_trim) {
|
||||
const bool normal_case = !throttle_rev && (throttle_trim == throttle_min);
|
||||
const bool reversed_case = throttle_rev && (throttle_trim == throttle_max);
|
||||
|
||||
if (normal_case || reversed_case) {
|
||||
const uint16_t new_throttle_trim = (throttle_min + throttle_max) / 2;
|
||||
_parameters.trim[throttle_channel] = new_throttle_trim;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue