From d8b62544c719f4bed6821aadf52ee8e45795df1a Mon Sep 17 00:00:00 2001 From: 3djc Date: Fri, 4 Dec 2020 16:03:41 +0100 Subject: [PATCH] Fix --- radio/src/opentx.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 1f15f97ed..5550b9bca 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1868,13 +1868,14 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim evalFlightModeMixes(e_perout_mode_noinput-e_perout_mode_notrims, 0); // do output loop - only trims - for (uint8_t i=0; i<4; i++) { + for (uint8_t i = 0; i < MAX_OUTPUT_CHANNELS; i++) { int16_t diff = applyLimits(i, chans[i]) - zeros[i]; int16_t v = g_model.limitData[i].offset; if (g_model.limitData[i].revert) diff = -diff; v += (diff * 125) / 128; - g_model.limitData[i].offset = limit((int16_t)-1000, (int16_t)v, (int16_t)1000); // make sure the offset doesn't go haywire + + g_model.limitData[i].offset = limit((int16_t) -1000, (int16_t) v, (int16_t) 1000); // make sure the offset doesn't go haywire } // reset all trims, except throttle (if throttle trim)