From 78ccc22eac88f1427f52d462d1c70a213579b501 Mon Sep 17 00:00:00 2001 From: DanielGeA Date: Sun, 4 Oct 2020 08:46:47 +0100 Subject: [PATCH] Throttle trim - Fixes 5635 (#7677) Add throttle trim switch --- companion/src/firmwares/modeldata.h | 1 + .../src/firmwares/opentx/opentxeeprom.cpp | 3 +- companion/src/modeledit/setup.cpp | 26 + companion/src/modeledit/setup.h | 2 + companion/src/modeledit/setup.ui | 503 +++++++++--------- radio/src/datastructs.h | 19 +- radio/src/gui/128x64/model_setup.cpp | 10 + radio/src/gui/212x64/model_setup.cpp | 9 + radio/src/gui/480x272/model_setup.cpp | 9 + radio/src/mixer.cpp | 12 +- radio/src/tests/mixer.cpp | 149 ++++++ radio/src/translations.cpp | 1 + radio/src/translations.h | 1 + radio/src/translations/cz.h.txt | 1 + radio/src/translations/de.h.txt | 1 + radio/src/translations/en.h.txt | 3 +- radio/src/translations/es.h.txt | 1 + radio/src/translations/fi.h.txt | 1 + radio/src/translations/fr.h.txt | 1 + radio/src/translations/it.h.txt | 1 + radio/src/translations/nl.h.txt | 1 + radio/src/translations/pl.h.txt | 1 + radio/src/translations/pt.h.txt | 1 + radio/src/translations/se.h.txt | 1 + 24 files changed, 503 insertions(+), 255 deletions(-) diff --git a/companion/src/firmwares/modeldata.h b/companion/src/firmwares/modeldata.h index 558b848df..0afc66b72 100644 --- a/companion/src/firmwares/modeldata.h +++ b/companion/src/firmwares/modeldata.h @@ -182,6 +182,7 @@ class ModelData { unsigned int thrTraceSrc; uint64_t switchWarningStates; unsigned int switchWarningEnable; + unsigned int thrTrimSwitch; unsigned int potsWarningMode; bool potsWarnEnabled[CPN_MAX_POTS]; int potsWarnPosition[CPN_MAX_POTS]; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 63b79d147..fcf0fc732 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -2421,7 +2421,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig internalField.Append(new UnsignedField<2>(this, modelData.potsWarningMode)); } else { - internalField.Append(new SpareBitsField<6>(this)); + internalField.Append(new SpareBitsField<3>(this)); + internalField.Append(new UnsignedField<3>(this, modelData.thrTrimSwitch)); internalField.Append(new UnsignedField<2>(this, modelData.potsWarningMode)); } diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index dcbe4f101..5d4dfec79 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -1276,6 +1276,14 @@ void SetupPanel::on_throttleSource_currentIndexChanged(int index) } } +void SetupPanel::on_throttleTrimSwitch_currentIndexChanged(int index) +{ + if (!lock) { + model->thrTrimSwitch = ui->throttleTrimSwitch->currentData().toUInt(); + emit modified(); + } +} + void SetupPanel::on_name_editingFinished() { if (QString(model->name) != ui->name->text()) { @@ -1348,11 +1356,29 @@ void SetupPanel::populateThrottleSourceCB() lock = false; } +void SetupPanel::populateThrottleTrimSwitchCB() +{ + Board::Type board = firmware->getBoard(); + lock = true; + ui->throttleTrimSwitch->clear(); + int idx=0; + for (int i=0; ithrottleTrimSwitch->addItem(trim, idx); + } + + int thrTrimSwitchIdx = ui->throttleTrimSwitch->findData(model->thrTrimSwitch); + ui->throttleTrimSwitch->setCurrentIndex(thrTrimSwitchIdx); + lock = false; +} + void SetupPanel::update() { ui->name->setText(model->name); ui->throttleReverse->setChecked(model->throttleReversed); populateThrottleSourceCB(); + populateThrottleTrimSwitchCB(); ui->throttleWarning->setChecked(!model->disableThrottleWarning); ui->trimIncrement->setCurrentIndex(model->trimInc+2); ui->throttleTrim->setChecked(model->thrTrim); diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 0aa48ea76..e0c3df507 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -138,6 +138,7 @@ class SetupPanel : public ModelPanel private slots: void on_name_editingFinished(); void on_throttleSource_currentIndexChanged(int index); + void on_throttleTrimSwitch_currentIndexChanged(int index); void on_throttleTrim_toggled(bool checked); void on_extendedLimits_toggled(bool checked); void on_extendedTrims_toggled(bool checked); @@ -176,6 +177,7 @@ class SetupPanel : public ModelPanel void updatePotWarnings(); void updateBeepCenter(); void populateThrottleSourceCB(); + void populateThrottleTrimSwitchCB(); int timersCount; int selectedTimerIndex; bool hasTimerClipboardData(QByteArray * data = nullptr) const; diff --git a/companion/src/modeledit/setup.ui b/companion/src/modeledit/setup.ui index fc499ad63..8b2409191 100644 --- a/companion/src/modeledit/setup.ui +++ b/companion/src/modeledit/setup.ui @@ -6,7 +6,7 @@ 0 0 - 893 + 1007 405 @@ -32,22 +32,6 @@ - - - - - 50 - false - - - - Top LCD Timer - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -149,6 +133,106 @@ + + + + + 75 + true + + + + Model + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Timer 3 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 50 + false + + + + Throttle Source + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Trim Step + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 50 + false + + + + Trims Display + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 50 + false + + + + Top LCD Timer + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -171,6 +255,66 @@ + + + + + 0 + 0 + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + + + + + 50 + false + + + + Timer 2 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + @@ -275,44 +419,8 @@ - - - - - 75 - true - - - - Model - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - + + Qt::Horizontal @@ -334,86 +442,13 @@ - - - - Qt::Horizontal - - - - - - - - Qt::LeftToRight - - - Display Checklist - - - - - - - - 0 - 0 - - - - - Never - - - - - On change - - - - - Always - - - - - - - - Qt::LeftToRight - - - Throttle Trim Idle Only - - - - - - - Global Functions - - - - - - - Qt::LeftToRight - - - Throttle Warning - - - - - - - - 0 - 0 - - - + + + 6 + + + @@ -450,6 +485,81 @@ + + + + + 0 + 0 + + + + + Never + + + + + On change + + + + + Always + + + + + + + + Qt::LeftToRight + + + Throttle Warning + + + + + + + Qt::LeftToRight + + + Display Checklist + + + + + + + Global Functions + + + + + + + + 0 + 0 + + + + Edit Checklist... + + + + + + + Qt::LeftToRight + + + Throttle Trim Idle Only + + + @@ -466,16 +576,10 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - - - - - 0 - 0 - - + + - Edit Checklist... + Throttle trim switch @@ -499,7 +603,17 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - + + + + + 0 + 0 + + + + + Qt::Horizontal @@ -514,107 +628,6 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi - - - - - - - 50 - false - - - - Throttle Source - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Trim Step - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Trims Display - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Horizontal - - - - - - - - 50 - false - - - - Timer 2 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 50 - false - - - - Timer 3 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 9f114c5f8..b37dd3e55 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -605,8 +605,9 @@ PACK(struct ModelData { NOBACKUP(RssiAlarmData rssiAlarms); - NOBACKUP(uint8_t spare1:6); - NOBACKUP(uint8_t potsWarnMode:2); + uint8_t spare1:3; + uint8_t thrTrimSw:3; + uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES]; int16_t failsafeChannels[MAX_OUTPUT_CHANNELS]; @@ -625,6 +626,20 @@ PACK(struct ModelData { CUSTOM_SCREENS_DATA char modelRegistrationID[PXX2_LEN_REGISTRATION_ID]; + + + uint8_t getThrottleStickTrimSource() const + { + // The order here is TERA, so that 0 (default) means Throttle + switch (thrTrimSw) { + case 0: + return MIXSRC_TrimThr; + case 2: + return MIXSRC_TrimRud; + default: + return thrTrimSw + MIXSRC_FIRST_TRIM; + } + } }); /* diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index e864ddc9f..41af5720f 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -66,6 +66,7 @@ enum MenuModelSetupItems { ITEM_MODEL_SETUP_THROTTLE_REVERSED, ITEM_MODEL_SETUP_THROTTLE_TRACE, ITEM_MODEL_SETUP_THROTTLE_TRIM, + ITEM_MODEL_SETUP_THROTTLE_TRIM_SWITCH, ITEM_MODEL_SETUP_PREFLIGHT_LABEL, ITEM_MODEL_SETUP_CHECKLIST_DISPLAY, ITEM_MODEL_SETUP_THROTTLE_WARNING, @@ -354,6 +355,7 @@ void menuModelSetup(event_t event) 0, // Throttle reverse 0, // Throttle trace source 0, // Throttle trim + 0, // Throttle trim switch LABEL(PreflightCheck), 0, // Checklist @@ -405,6 +407,7 @@ void menuModelSetup(event_t event) 0, // Throttle reverse 0, // Throttle trace source 0, // Throttle trim + 0, // Throttle trim switch LABEL(PreflightCheck), 0, // Checklist @@ -617,6 +620,13 @@ void menuModelSetup(event_t event) ON_OFF_MENU_ITEM(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, STR_TTRIM, attr, event); break; + case ITEM_MODEL_SETUP_THROTTLE_TRIM_SWITCH: + lcdDrawTextAlignedLeft(y, STR_TTRIM_SW); + if (attr) + CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTrimSw, NUM_TRIMS - 1); + drawSource(MODEL_SETUP_2ND_COLUMN, y, g_model.getThrottleStickTrimSource(), attr); + break; + case ITEM_MODEL_SETUP_PREFLIGHT_LABEL: lcdDrawTextAlignedLeft(y, STR_PREFLIGHT); break; diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 7503ae92a..5a2d05446 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -66,6 +66,7 @@ enum MenuModelSetupItems { ITEM_MODEL_SETUP_THROTTLE_REVERSED, ITEM_MODEL_SETUP_THROTTLE_TRACE, ITEM_MODEL_SETUP_THROTTLE_TRIM, + ITEM_MODEL_SETUP_THROTTLE_TRIM_SWITCH, ITEM_MODEL_SETUP_PREFLIGHT_LABEL, ITEM_MODEL_SETUP_CHECKLIST_DISPLAY, ITEM_MODEL_SETUP_THROTTLE_WARNING, @@ -344,6 +345,7 @@ void menuModelSetup(event_t event) 0, // Thrxottle reverse 0, // Throttle trace source 0, // Throttle trim + 0, // Throttle trim switch LABEL(PreflightCheck), 0, // Checklist @@ -571,6 +573,13 @@ void menuModelSetup(event_t event) ON_OFF_MENU_ITEM(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, STR_TTRIM, attr, event); break; + case ITEM_MODEL_SETUP_THROTTLE_TRIM_SWITCH: + lcdDrawTextAlignedLeft(y, STR_TTRIM_SW); + if (attr) + CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTrimSw, NUM_TRIMS - 1); + drawSource(MODEL_SETUP_2ND_COLUMN, y, g_model.getThrottleStickTrimSource(), attr); + break; + case ITEM_MODEL_SETUP_PREFLIGHT_LABEL: lcdDrawTextAlignedLeft(y, STR_PREFLIGHT); break; diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index 315d5a23e..5eeb7cb93 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -53,6 +53,7 @@ enum MenuModelSetupItems { ITEM_MODEL_SETUP_THROTTLE_REVERSED, ITEM_MODEL_SETUP_THROTTLE_TRACE, ITEM_MODEL_SETUP_THROTTLE_TRIM, + ITEM_MODEL_SETUP_THROTTLE_TRIM_SWITCH, ITEM_MODEL_SETUP_PREFLIGHT_LABEL, ITEM_MODEL_SETUP_CHECKLIST_DISPLAY, ITEM_MODEL_SETUP_THROTTLE_WARNING, @@ -614,6 +615,7 @@ bool menuModelSetup(event_t event) 0, // Throttle reverse 0, // Throttle trace source 0, // Throttle trim + 0, // Throttle trim switch LABEL(PreflightCheck), 0, // Display checklist @@ -835,6 +837,13 @@ bool menuModelSetup(event_t event) g_model.thrTrim = editCheckBox(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, attr, event); break; + case ITEM_MODEL_SETUP_THROTTLE_TRIM_SWITCH: + lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TTRIM_SW); + if (attr) + CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTrimSw, NUM_TRIMS - 1); + drawSource(MODEL_SETUP_2ND_COLUMN, y, g_model.getThrottleStickTrimSource(), attr); + break; + case ITEM_MODEL_SETUP_PREFLIGHT_LABEL: lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PREFLIGHT); break; diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index ee03c9f47..56abde109 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -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; diff --git a/radio/src/tests/mixer.cpp b/radio/src/tests/mixer.cpp index 074f7f6ca..deaf3ec14 100644 --- a/radio/src/tests/mixer.cpp +++ b/radio/src/tests/mixer.cpp @@ -720,3 +720,152 @@ TEST_F(MixerTest, flightModeOverflow) simuSetSwitch(0, 1); CHECK_FLIGHT_MODE_TRANSITION(0, 1000, 1024, 1024); } + +TEST_F(TrimsTest, throttleTrimWithCrossTrims) +{ + g_model.thrTrim = 1; + g_model.thrTrimSw = MIXSRC_TrimEle - MIXSRC_FIRST_TRIM; + ExpoData *expo = expoAddress(THR_STICK); + expo->carryTrim = TRIM_ELE; + expo = expoAddress(ELE_STICK); + expo->carryTrim = TRIM_THR; + + // stick max + trim max + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], 1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick max + trim min + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], 1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim max + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024 + 500); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim mid + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, 0); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024 + 250); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim min + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024); + EXPECT_EQ(channelOutputs[1], 0); + + // now the same tests with extended Trims + g_model.extendedTrims = 1; + // stick max + trim max + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], 1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick max + trim min + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], 1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim max + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024+2000); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim mid + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, 0); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024+1000); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim min + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024); + EXPECT_EQ(channelOutputs[1], 0); +} + +TEST_F(TrimsTest, invertedThrottlePlusThrottleTrimWithCrossTrims) +{ + g_model.throttleReversed = 1; + g_model.thrTrim = 1; + g_model.thrTrimSw = MIXSRC_TrimEle - MIXSRC_FIRST_TRIM; + ExpoData *expo = expoAddress(THR_STICK); + expo->carryTrim = TRIM_ELE; + expo = expoAddress(ELE_STICK); + expo->carryTrim = TRIM_THR; + + // stick max + trim max + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick max + trim mid + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, 0); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024+250); + EXPECT_EQ(channelOutputs[1], 0); + // stick max + trim min + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024+500); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim max + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], +1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim min + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], +1024); + EXPECT_EQ(channelOutputs[1], 0); + + // now the same tests with extended Trims + g_model.extendedTrims = 1; + // stick max + trim max + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick max + trim mid + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, 0); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024+1000); + EXPECT_EQ(channelOutputs[1], 0); + // stick max + trim min + anaInValues[THR_STICK] = +1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], -1024+2000); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim max + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MAX); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], +1024); + EXPECT_EQ(channelOutputs[1], 0); + // stick min + trim min + anaInValues[THR_STICK] = -1024; + setTrimValue(0, MIXSRC_TrimEle - MIXSRC_FIRST_TRIM, TRIM_EXTENDED_MIN); + evalMixes(1); + EXPECT_EQ(channelOutputs[2], +1024); + EXPECT_EQ(channelOutputs[1], 0); +} diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index a6f888678..f7a6e04f8 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -123,6 +123,7 @@ const char STR_TRIMINC[] = TR_TRIMINC; const char STR_DISPLAY_TRIMS[] = TR_DISPLAY_TRIMS; const char STR_TTRACE[] = TR_TTRACE; const char STR_TTRIM[] = TR_TTRIM; +const char STR_TTRIM_SW[] = TR_TTRIM_SW; const char STR_BEEPCTR[] = TR_BEEPCTR; const char STR_USE_GLOBAL_FUNCS[] = TR_USE_GLOBAL_FUNCS; const char STR_PPMFRAME[] = TR_PPMFRAME; diff --git a/radio/src/translations.h b/radio/src/translations.h index 544ad183c..1e02adcf9 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -215,6 +215,7 @@ extern const char STR_TRIMINC[]; extern const char STR_DISPLAY_TRIMS[]; extern const char STR_TTRACE[]; extern const char STR_TTRIM[]; +extern const char STR_TTRIM_SW[]; extern const char STR_BEEPCTR[]; extern const char STR_USE_GLOBAL_FUNCS[]; diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 849be4620..59b5c72a9 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -432,6 +432,7 @@ #define TR_DISPLAY_TRIMS TR3("Číslo v Trm", "Zobr.hodnotu trimu", "Číslo v liště trimu") #define TR_TTRACE TR("StopaPlynu", INDENT "Stopa plynu") #define TR_TTRIM TR3("TrimVolnob.", INDENT "Trim jen volnoběh", "Trim jen pro volnoběh") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR3("Středy \221\222", "Pípat středy \221\222", "Pípat středy") #define TR_USE_GLOBAL_FUNCS TR("Glob.Funkce", "Použít Glob.Funkce") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 20c1a392e..544df5277 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -434,6 +434,7 @@ #define TR_DISPLAY_TRIMS TR("Trimanzeige", "Trimwerte anzeigen") #define TR_TTRACE TR("Gasquelle", INDENT "Gas-Timerquelle") #define TR_TTRIM TR("Gastrim", INDENT "Gas-Leerlauftrim") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("MittePieps", "Mittelstell. -Pieps") #define TR_USE_GLOBAL_FUNCS TR("Glob. Funkt.", "Globale Funkt verw.") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 50c662ef9..e2f7e4529 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -432,7 +432,8 @@ #define TR_TRIMINC "Trim Step" #define TR_DISPLAY_TRIMS TR("Show Trims", "Display trims") #define TR_TTRACE TR("T-Source", INDENT "Source") -#define TR_TTRIM TR("T-Trim", INDENT "Trim idle only") +#define TR_TTRIM TR("T-Trim-Idle", INDENT "Trim idle only") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Ctr Beep", "Center Beep") #define TR_USE_GLOBAL_FUNCS TR("Glob.Funcs", "Use global funcs") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index ed6607694..7d6b6f3b0 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -432,6 +432,7 @@ #define TR_DISPLAY_TRIMS "Ver trims" #define TR_TTRACE TR("Fuente-A", INDENT "Fuente acelerador") #define TR_TTRIM TR("Trim-A", INDENT "Trim acelerador") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Beep ctr", "Beep centro") #define TR_USE_GLOBAL_FUNCS TR("Funcs. glob.", "Usar func. globales") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index f4e22844e..cfc84aa1e 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -446,6 +446,7 @@ #define TR_DISPLAY_TRIMS "Display Trims" #define TR_TTRACE TR("T-Source", INDENT "Throttle Source") #define TR_TTRIM TR("T-Trim", INDENT "Throttle Trim") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Ctr Beep", "Center Beep") #define TR_USE_GLOBAL_FUNCS "Use Global Funcs" #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index a173accd8..4ac49e586 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -452,6 +452,7 @@ #define TR_DISPLAY_TRIMS TR("Aff. trims", "Affichage trims") #define TR_TTRACE TR("Source gaz", INDENT "Source") #define TR_TTRIM TR("Trim gaz", INDENT "Trim ralenti uniq.") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Bips centr", "Bips centrage") #define TR_USE_GLOBAL_FUNCS TR("Fonc. glob.", "Fonctions globales") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index abc1c3acf..f54d41ad9 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -454,6 +454,7 @@ #define TR_DISPLAY_TRIMS TR("Mos. Trims", "Mostra Trims") #define TR_TTRACE TR("So. motore", INDENT "Sorgente Motore") #define TR_TTRIM TR("Trim Mot.", INDENT "Trim Motore") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Beep al c.", "Beep al centro") #define TR_USE_GLOBAL_FUNCS "Usa Funz. Globali" #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/nl.h.txt b/radio/src/translations/nl.h.txt index 5474f7ca9..d007f8626 100644 --- a/radio/src/translations/nl.h.txt +++ b/radio/src/translations/nl.h.txt @@ -433,6 +433,7 @@ #define TR_DISPLAY_TRIMS "Toon Trims" #define TR_TTRACE TR("T-Source", INDENT "Source") #define TR_TTRIM TR("T-Trim", INDENT "Trim Idle Only") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Ctr Beep", "Center Beep") #define TR_USE_GLOBAL_FUNCS TR("Glob.Funcs", "Globale Functies") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 814e27ae6..3e3c08ed8 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -453,6 +453,7 @@ #define TR_DISPLAY_TRIMS TR("Pok.Trym.","Pokaż Trymery") #define TR_TTRACE TR("Źród gaz", INDENT "Źródło gazu ") #define TR_TTRIM TR("TryGaz", INDENT "TrymWolnObrotó") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("ŚrodBeep", "Pikn.Środka") #define TR_USE_GLOBAL_FUNCS TR("Funk.Glb.","Użyj Funkcji Glb") #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index f1b76fc4c..35bda6e7e 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -439,6 +439,7 @@ #define TR_DISPLAY_TRIMS "Display Trims" #define TR_TTRACE TR("T-Trace", INDENT "T-Trace") #define TR_TTRIM TR("T-Trim", INDENT "T-Trim") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR "Ctr Beep" #define TR_USE_GLOBAL_FUNCS "Use Global Funcs" #if defined(PCBSKY9X) && defined(REVX) diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 73e863966..aafa32bcb 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -452,6 +452,7 @@ #define TR_DISPLAY_TRIMS "Display Trims" #define TR_TTRACE TR("Följ Gas", INDENT "Följ Gas") #define TR_TTRIM TR("Gastrim", INDENT "Gastrim") +#define TR_TTRIM_SW TR("T-Trim-Sw", INDENT "Trim switch") #define TR_BEEPCTR TR("Cent.pip", "Centerpip") #define TR_USE_GLOBAL_FUNCS TR("Glob.Funkt", "Använd Global Funk.") #if defined(PCBSKY9X) && defined(REVX)