Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.14] rc_update: throttle trim centering fix for reverse channel #21692

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For release notes:
```
Feature/Bugfix XYZ
New parameter: XYZ_Z
Documentation: Need to clarfiy page ... / done, read docs.px4.io/...
Documentation: Need to clarify page ... / done, read docs.px4.io/...
```

### Alternatives
Expand Down
6 changes: 5 additions & 1 deletion src/modules/rc_update/rc_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down