diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 9e8d1a0ac..fa59432e1 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -650,7 +650,7 @@ int getStickTrimValue(int stick, int stickValue) return 0; int trim = trims[stick]; - if (IS_THROTTLE_TRIM(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); diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 92baf0835..ab092b73e 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1386,7 +1386,7 @@ uint8_t checkTrim(event_t event) #else before = getRawTrimValue(phase, idx); #endif - thro = (IS_THROTTLE_TRIM(idx) && g_model.thrTrim); + thro = (idx==THR_STICK && g_model.thrTrim); } #else phase = getTrimFlightMode(mixerCurrentFlightMode, idx); @@ -1395,7 +1395,7 @@ uint8_t checkTrim(event_t event) #else before = getRawTrimValue(phase, idx); #endif - thro = (IS_THROTTLE_TRIM(idx) && g_model.thrTrim); + thro = (idx==THR_STICK && g_model.thrTrim); #endif int8_t trimInc = g_model.trimInc + 1; int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc); // TODO flash saving if (trimInc < 0) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 7a4195ea1..2fb37381c 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -334,12 +334,6 @@ void memswap(void * a, void * b, uint8_t size); #define IS_MULTIPOS_CALIBRATED(cal) (false) #endif -#if defined(VIRTUAL_INPUTS) - #define IS_THROTTLE_TRIM(x) (x == virtualInputsTrims[THR_STICK]) -#else - #define IS_THROTTLE_TRIM(x) (x == THR_STICK) -#endif - #if defined(PWR_BUTTON_PRESS) #define pwrOffPressed() pwrPressed() #else diff --git a/radio/src/tests/mixer.cpp b/radio/src/tests/mixer.cpp index 9d3c439e5..367f6db13 100644 --- a/radio/src/tests/mixer.cpp +++ b/radio/src/tests/mixer.cpp @@ -75,7 +75,6 @@ TEST_F(TrimsTest, throttleTrim) setTrimValue(0, THR_STICK, TRIM_MIN); evalMixes(1); EXPECT_EQ(channelOutputs[2], -1024); - // now the same tests with extended Trims g_model.extendedTrims = 1; // stick max + trim max @@ -392,6 +391,22 @@ TEST_F(TrimsTest, InstantTrimNegativeCurve) } #endif +TEST_F(TrimsTest, throttleTrimEle) { + SYSTEM_RESET(); + MODEL_RESET(); + MIXER_RESET(); + modelDefault(0); + g_eeGeneral.templateSetup = 17; + applyDefaultTemplate(); + g_model.thrTrim = 1; +// checks ELE sticks are not affected by throttleTrim +// stick max + trim min + anaInValues[ELE_STICK] = +1024; + setTrimValue(0, ELE_STICK, TRIM_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], 1024 - 250); +} + TEST(Curves, LinearIntpol) { SYSTEM_RESET();