mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Apply #6036 equivalent to 2.3
This commit is contained in:
parent
12d675a0a7
commit
3556d7c0e8
4 changed files with 18 additions and 5 deletions
|
@ -531,7 +531,7 @@ int getStickTrimValue(int stick, int stickValue)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int trim = trims[stick];
|
int trim = trims[stick];
|
||||||
if (IS_THROTTLE_TRIM(stick)) {
|
if (stick == THR_STICK) {
|
||||||
if (g_model.thrTrim) {
|
if (g_model.thrTrim) {
|
||||||
int trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN;
|
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);
|
trim = ((g_model.throttleReversed ? (trim+trimMin) : (trim-trimMin)) * (RESX-stickValue)) >> (RESX_SHIFT+1);
|
||||||
|
|
|
@ -1141,12 +1141,12 @@ void checkTrims()
|
||||||
else {
|
else {
|
||||||
phase = getTrimFlightMode(mixerCurrentFlightMode, idx);
|
phase = getTrimFlightMode(mixerCurrentFlightMode, idx);
|
||||||
before = getTrimValue(phase, idx);
|
before = getTrimValue(phase, idx);
|
||||||
thro = (IS_THROTTLE_TRIM(idx) && g_model.thrTrim);
|
thro = (idx==THR_STICK && g_model.thrTrim);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
phase = getTrimFlightMode(mixerCurrentFlightMode, idx);
|
phase = getTrimFlightMode(mixerCurrentFlightMode, idx);
|
||||||
before = getTrimValue(phase, idx);
|
before = getTrimValue(phase, idx);
|
||||||
thro = (IS_THROTTLE_TRIM(idx) && g_model.thrTrim);
|
thro = (idx==THR_STICK && g_model.thrTrim);
|
||||||
#endif
|
#endif
|
||||||
int8_t trimInc = g_model.trimInc + 1;
|
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)
|
int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc); // TODO flash saving if (trimInc < 0)
|
||||||
|
|
|
@ -292,8 +292,6 @@ void memswap(void * a, void * b, uint8_t size);
|
||||||
#define IS_MULTIPOS_CALIBRATED(cal) (false)
|
#define IS_MULTIPOS_CALIBRATED(cal) (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_THROTTLE_TRIM(x) (x == virtualInputsTrims[THR_STICK])
|
|
||||||
|
|
||||||
#if defined(PWR_BUTTON_PRESS)
|
#if defined(PWR_BUTTON_PRESS)
|
||||||
#define pwrOffPressed() pwrPressed()
|
#define pwrOffPressed() pwrPressed()
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -553,6 +553,21 @@ TEST_F(MixerTest, SlowOnMultiply)
|
||||||
CHECK_NO_MOVEMENT(0, CHANNEL_MAX, 250);
|
CHECK_NO_MOVEMENT(0, CHANNEL_MAX, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(HELI)
|
#if defined(HELI)
|
||||||
TEST(Heli, BasicTest)
|
TEST(Heli, BasicTest)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue