Throttle trim - Fixes 5635 (#7677)

Add throttle trim switch
This commit is contained in:
DanielGeA
2020-10-04 09:46:47 +02:00
committed by GitHub
parent 5ec01f90cf
commit 78ccc22eac
24 changed files with 503 additions and 255 deletions
+6 -6
View File
@@ -527,13 +527,13 @@ int getStickTrimValue(int stick, int stickValue)
return 0;
int trim = trims[stick];
if (stick == THR_STICK) {
if (g_model.thrTrim) {
int trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN;
trim = ((g_model.throttleReversed ? (trim+trimMin) : (trim-trimMin)) * (RESX-stickValue)) >> (RESX_SHIFT+1);
}
if (g_model.throttleReversed) {
uint8_t thrTrimSw = g_model.getThrottleStickTrimSource() - MIXSRC_FIRST_TRIM;
if (stick == thrTrimSw) {
if (g_model.throttleReversed)
trim = -trim;
if (g_model.thrTrim) {
trim = (g_model.extendedTrims) ? 2*TRIM_EXTENDED_MAX + trim : 2*TRIM_MAX + trim;
trim = trim * (1024 - stickValue) / (2*RESX);
}
}
return trim;