diff --git a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp index f3036835ef8..c984db09fb6 100644 --- a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp +++ b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp @@ -202,7 +202,7 @@ Node convert::encode(const GeneralSettings& rhs) node["noJitterFilter"] = (int)rhs.noJitterFilter; node["disableRtcWarning"] = (int)rhs.rtcCheckDisable; // TODO: verify node["keysBacklight"] = (int)rhs.keysBacklight; - node["rotEncDirection"] = (int)rhs.rotEncDirection; + node["rotEncMode"] = (int)rhs.rotEncMode; node["imperial"] = rhs.imperial; node["ttsLanguage"] = rhs.ttsLanguage; node["beepVolume"] = rhs.beepVolume + 2; @@ -396,7 +396,8 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) node["noJitterFilter"] >> rhs.noJitterFilter; // new, but don't write old node["disableRtcWarning"] >> rhs.rtcCheckDisable; // TODO: verify node["keysBacklight"] >> rhs.keysBacklight; - node["rotEncDirection"] >> rhs.rotEncDirection; + node["rotEncDirection"] >> rhs.rotEncMode; // PR2045: read old name and + node["rotEncMode"] >> rhs.rotEncMode; // new, but don't write old node["imperial"] >> rhs.imperial; node["ttsLanguage"] >> rhs.ttsLanguage; node["beepVolume"] >> ioffset_int(rhs.beepVolume, 2); diff --git a/companion/src/firmwares/generalsettings.h b/companion/src/firmwares/generalsettings.h index 19248b20391..af7a35a63c8 100644 --- a/companion/src/firmwares/generalsettings.h +++ b/companion/src/firmwares/generalsettings.h @@ -238,7 +238,7 @@ class GeneralSettings { bool noJitterFilter; bool rtcCheckDisable; bool keysBacklight; - bool rotEncDirection; + unsigned int rotEncMode; unsigned int imperial; char ttsLanguage[TTS_LANGUAGE_LEN + 1]; int beepVolume; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 338f81ed209..59581ffadb9 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -3035,11 +3035,10 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type internalField.Append(new BoolField<1>(this, generalData.rtcCheckDisable)); if (IS_JUMPER_T18(board)) { internalField.Append(new BoolField<1>(this, generalData.keysBacklight)); - internalField.Append(new BoolField<1>(this, generalData.rotEncDirection)); + internalField.Append(new SpareBitsField<1>(this)); } else { - internalField.Append(new SpareBitsField<1>(this)); - internalField.Append(new BoolField<1>(this, generalData.rotEncDirection)); + internalField.Append(new SpareBitsField<2>(this)); } for (int i=0; i<4; i++) { @@ -3350,6 +3349,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type if (version >= 220) { internalField.Append(new SignedField<2>(this, generalData.uartSampleMode, "Uart Sample Mode")); + internalField.Append(new UnsignedField<2>(this, generalData.rotEncMode)); //internalField.Append(new SpareBitsField<6>(this)); // may need padding to end of 8 byte boundary } } diff --git a/companion/src/generaledit/generalsetup.cpp b/companion/src/generaledit/generalsetup.cpp index 96c13554d97..5a67541bcaf 100644 --- a/companion/src/generaledit/generalsetup.cpp +++ b/companion/src/generaledit/generalsetup.cpp @@ -126,11 +126,11 @@ ui(new Ui::GeneralSetup) } if (!firmware->getCapability(RotaryEncoderNavigation)) { - ui->invertRotary_CB->hide(); - ui->invertRotary_label->hide(); + ui->rotEncMode_CB->hide(); + ui->rotEncMode_label->hide(); } else { - ui->invertRotary_CB->setChecked(generalSettings.rotEncDirection); + populateRotEncModeCB(); } if (!firmware->getCapability(HasPxxCountry)) { @@ -483,10 +483,29 @@ void GeneralSetupPanel::on_faimode_CB_stateChanged(int) emit modified(); } -void GeneralSetupPanel::on_invertRotary_CB_stateChanged(int) +void GeneralSetupPanel::populateRotEncModeCB() { - generalSettings.rotEncDirection = ui->invertRotary_CB->isChecked(); - emit modified(); + QComboBox * b = ui->rotEncMode_CB; + QString strings[] = { tr("Normal"), tr("Inverted"), tr("Vertical Inverted, Horizontal Normal"), tr("Vertical Inverted, Horizontal Alternate") }; + int itemCount = 4; + + if (Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) { + itemCount = 2; + } + + b->clear(); + for (uint8_t i=0; i < itemCount; i++) { + b->addItem(strings[i], 0); + } + b->setCurrentIndex(generalSettings.rotEncMode); +} + +void GeneralSetupPanel::on_rotEncMode_CB_currentIndexChanged(int index) +{ + if (!lock) { + generalSettings.rotEncMode = index; + emit modified(); + } } void GeneralSetupPanel::on_speakerPitchSB_editingFinished() diff --git a/companion/src/generaledit/generalsetup.h b/companion/src/generaledit/generalsetup.h index 3ac2e8dffcb..7afd5495357 100644 --- a/companion/src/generaledit/generalsetup.h +++ b/companion/src/generaledit/generalsetup.h @@ -49,7 +49,7 @@ class GeneralSetupPanel : public GeneralPanel void on_countrycode_CB_currentIndexChanged(int index); void on_units_CB_currentIndexChanged(int index); void on_faimode_CB_stateChanged(int ); - void on_invertRotary_CB_stateChanged(int); + void on_rotEncMode_CB_currentIndexChanged(int index); void on_speakerPitchSB_editingFinished(); void on_timezoneSB_editingFinished(); void on_adjustRTC_stateChanged(int); @@ -100,6 +100,7 @@ class GeneralSetupPanel : public GeneralPanel void populateBacklightCB(); void populateVoiceLangCB(); void populateRotEncCB(int reCount); + void populateRotEncModeCB(); void updateVarioPitchRange(); }; diff --git a/companion/src/generaledit/generalsetup.ui b/companion/src/generaledit/generalsetup.ui index ca651917bb4..fac9be1da7d 100644 --- a/companion/src/generaledit/generalsetup.ui +++ b/companion/src/generaledit/generalsetup.ui @@ -1146,21 +1146,14 @@ p, li { white-space: pre-wrap; } - + - Invert Rotary + Rotary Encoder Mode - - - Invert the direction of the rotary encoder - - - - - + diff --git a/radio/src/datastructs_private.h b/radio/src/datastructs_private.h index 7aaece68bea..5cc7537973d 100644 --- a/radio/src/datastructs_private.h +++ b/radio/src/datastructs_private.h @@ -812,7 +812,7 @@ PACK(struct TrainerData { #if defined(BUZZER) #define BUZZER_FIELD int8_t buzzerMode:2 // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware) #else - #define BUZZER_FIELD int8_t spare1:2 SKIP + #define BUZZER_FIELD int8_t spare2:2 SKIP #endif PACK(struct RadioData { @@ -830,7 +830,7 @@ PACK(struct RadioData { int8_t antennaMode:2 ENUM(AntennaModes); uint8_t disableRtcWarning:1; uint8_t keysBacklight:1; - int8_t rotEncDirection:1; + NOBACKUP(uint8_t spare1:1 SKIP); NOBACKUP(uint8_t internalModule ENUM(ModuleType)); NOBACKUP(TrainerData trainer); NOBACKUP(uint8_t view); // index of view in main screen @@ -899,13 +899,17 @@ PACK(struct RadioData { char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID]; + CUST_ATTR(rotEncDirection, r_rotEncDirection, nullptr); + NOBACKUP(uint8_t rotEncMode:2); + NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes + #if defined(STICK_DEAD_ZONE) NOBACKUP(uint8_t stickDeadZone:3); - NOBACKUP(uint8_t spare2:3 SKIP); #else - NOBACKUP(uint8_t spare2:6 SKIP); + NOBACKUP(uint8_t stickDeadZoneSpare:3 SKIP); #endif + NOBACKUP(uint8_t spare4:1 SKIP); #if defined(IMU) NOBACKUP(int8_t imuMax); diff --git a/radio/src/gui/128x64/radio_setup.cpp b/radio/src/gui/128x64/radio_setup.cpp index 61c63adf13a..72a57b64645 100644 --- a/radio/src/gui/128x64/radio_setup.cpp +++ b/radio/src/gui/128x64/radio_setup.cpp @@ -102,7 +102,7 @@ enum { ITEM_RADIO_SETUP_USB_MODE, CASE_JACK_DETECT(ITEM_RADIO_SETUP_JACK_MODE) ITEM_RADIO_SETUP_RX_CHANNEL_ORD, - CASE_ROTARY_ENCODER(ITEM_RADIO_SETUP_ROTARY_INVERSE) + CASE_ROTARY_ENCODER(ITEM_RADIO_SETUP_ROTARY_ENC_MODE) ITEM_RADIO_SETUP_STICK_MODE_LABELS, ITEM_RADIO_SETUP_STICK_MODE, ITEM_RADIO_SETUP_MAX @@ -137,7 +137,7 @@ void menuRadioSetup(event_t event) #endif uint8_t old_editMode = s_editMode; - + MENU(STR_RADIO_SETUP, menuTabGeneral, MENU_RADIO_SETUP, HEADER_LINE+ITEM_RADIO_SETUP_MAX, { HEADER_LINE_COLUMNS CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1) LABEL(SOUND), CASE_AUDIO(0) @@ -181,6 +181,9 @@ void menuRadioSetup(event_t event) if (event == EVT_ENTRY) { reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode; +#if defined(ROTARY_ENCODER_NAVIGATION) + reusableBuffer.generalSettings.rotaryEncoderMode = g_eeGeneral.rotEncMode; +#endif } uint8_t sub = menuVerticalPosition - HEADER_LINE; @@ -661,8 +664,21 @@ void menuRadioSetup(event_t event) break; #if defined(ROTARY_ENCODER_NAVIGATION) - case ITEM_RADIO_SETUP_ROTARY_INVERSE: - g_eeGeneral.rotEncDirection = editCheckBox(g_eeGeneral.rotEncDirection, RADIO_SETUP_2ND_COLUMN, y, STR_INVERT_ROTARY, attr, event); + case ITEM_RADIO_SETUP_ROTARY_ENC_MODE: + lcdDrawTextAlignedLeft(y, STR_ROTARY_ENC_MODE); + lcdDrawTextAtIndex(RADIO_SETUP_2ND_COLUMN, y, STR_ROTARY_ENC_OPT, + reusableBuffer.generalSettings.rotaryEncoderMode, + attr); + if (attr && s_editMode > 0) { + CHECK_INCDEC_GENVAR(event, + reusableBuffer.generalSettings.rotaryEncoderMode, + ROTARY_ENCODER_MODE_NORMAL, + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_ALT); + } else if (reusableBuffer.generalSettings.rotaryEncoderMode != + g_eeGeneral.rotEncMode) { + g_eeGeneral.rotEncMode = + reusableBuffer.generalSettings.rotaryEncoderMode; + } break; #endif diff --git a/radio/src/gui/212x64/radio_setup.cpp b/radio/src/gui/212x64/radio_setup.cpp index c2a701498df..52c0d2444c7 100644 --- a/radio/src/gui/212x64/radio_setup.cpp +++ b/radio/src/gui/212x64/radio_setup.cpp @@ -95,7 +95,7 @@ enum MenuRadioSetupItems { ITEM_RADIO_SETUP_SWITCHES_DELAY, ITEM_RADIO_SETUP_USB_MODE, ITEM_RADIO_SETUP_RX_CHANNEL_ORD, - CASE_ROTARY_ENCODER(ITEM_RADIO_SETUP_ROTARY_INVERSE) + CASE_ROTARY_ENCODER(ITEM_RADIO_SETUP_ROTARY_ENC_MODE) ITEM_RADIO_SETUP_STICK_MODE_LABELS, ITEM_RADIO_SETUP_STICK_MODE, ITEM_RADIO_SETUP_MAX @@ -124,7 +124,7 @@ void menuRadioSetup(event_t event) #endif uint8_t old_editMode = s_editMode; - + MENU(STR_RADIO_SETUP, menuTabGeneral, MENU_RADIO_SETUP, ITEM_RADIO_SETUP_MAX, { 2, // date 2, // time @@ -183,6 +183,9 @@ void menuRadioSetup(event_t event) if (event == EVT_ENTRY) { reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode; +#if defined(ROTARY_ENCODER_NAVIGATION) + reusableBuffer.generalSettings.rotaryEncoderMode = g_eeGeneral.rotEncMode; +#endif } int sub = menuVerticalPosition; @@ -591,8 +594,21 @@ void menuRadioSetup(event_t event) break; #if defined(ROTARY_ENCODER_NAVIGATION) - case ITEM_RADIO_SETUP_ROTARY_INVERSE: - g_eeGeneral.rotEncDirection = editCheckBox(g_eeGeneral.rotEncDirection, RADIO_SETUP_2ND_COLUMN, y, STR_INVERT_ROTARY, attr, event); + case ITEM_RADIO_SETUP_ROTARY_ENC_MODE: + lcdDrawTextAlignedLeft(y, STR_ROTARY_ENC_MODE); + lcdDrawTextAtIndex(RADIO_SETUP_2ND_COLUMN, y, STR_ROTARY_ENC_OPT, + reusableBuffer.generalSettings.rotaryEncoderMode, + attr); + if (attr && s_editMode > 0) { + CHECK_INCDEC_GENVAR(event, + reusableBuffer.generalSettings.rotaryEncoderMode, + ROTARY_ENCODER_MODE_NORMAL, + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_ALT); + } else if (reusableBuffer.generalSettings.rotaryEncoderMode != + g_eeGeneral.rotEncMode) { + g_eeGeneral.rotEncMode = + reusableBuffer.generalSettings.rotaryEncoderMode; + } break; #endif diff --git a/radio/src/gui/colorlcd/radio_setup.cpp b/radio/src/gui/colorlcd/radio_setup.cpp index 50b90761092..b52baabdec8 100644 --- a/radio/src/gui/colorlcd/radio_setup.cpp +++ b/radio/src/gui/colorlcd/radio_setup.cpp @@ -698,8 +698,10 @@ void RadioSetupPage::build(FormWindow * window) #if defined(ROTARY_ENCODER_NAVIGATION) line = window->newLine(&grid); - new StaticText(line, rect_t{}, STR_INVERT_ROTARY, 0, COLOR_THEME_PRIMARY1); - new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_eeGeneral.rotEncDirection)); + new StaticText(line, rect_t{}, STR_ROTARY_ENC_MODE, 0, COLOR_THEME_PRIMARY1); + new Choice(line, rect_t{}, STR_ROTARY_ENC_OPT, ROTARY_ENCODER_MODE_NORMAL, + ROTARY_ENCODER_MODE_INVERT_BOTH, + GET_SET_DEFAULT(g_eeGeneral.rotEncMode)); #endif // RX channel order diff --git a/radio/src/gui/common/stdlcd/popups.cpp b/radio/src/gui/common/stdlcd/popups.cpp index 3926d9ff1f4..ecef235863f 100644 --- a/radio/src/gui/common/stdlcd/popups.cpp +++ b/radio/src/gui/common/stdlcd/popups.cpp @@ -94,7 +94,19 @@ const char * runPopupMenu(event_t event) drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), popupMenuOffset, popupMenuItemsCount, display_count); } - switch (event) { + event_t eventTemp = event; + +#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(COLORLCD) + if (g_eeGeneral.rotEncMode >= ROTARY_ENCODER_MODE_INVERT_BOTH) { + if (eventTemp == EVT_ROTARY_LEFT) { + eventTemp = EVT_ROTARY_RIGHT; + } else if (eventTemp == EVT_ROTARY_RIGHT) { + eventTemp = EVT_ROTARY_LEFT; + } + } +#endif + + switch (eventTemp) { #if defined(ROTARY_ENCODER_NAVIGATION) CASE_EVT_ROTARY_LEFT #endif diff --git a/radio/src/gui/navigation/navigation_9x.cpp b/radio/src/gui/navigation/navigation_9x.cpp index 598d3b266ec..c631a5f8779 100644 --- a/radio/src/gui/navigation/navigation_9x.cpp +++ b/radio/src/gui/navigation/navigation_9x.cpp @@ -345,7 +345,16 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t case EVT_KEY_FIRST(KEY_DOWN): if (s_editMode>0) break; do { +#if defined(ROTARY_ENCODER_NAVIGATION) + if (g_eeGeneral.rotEncMode >= + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM) { + DEC(l_posVert, 0, maxrow); + } else { + INC(l_posVert, 0, maxrow); + } +#else INC(l_posVert, 0, maxrow); +#endif } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); #if defined(ROTARY_ENCODER_NAVIGATION) @@ -368,12 +377,13 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t if (l_posHorz > 0) { l_posHorz--; break; - } - else if (IS_ROTARY_LEFT(event) && s_editMode == 0) { + } else if (IS_ROTARY_LEFT(event) && s_editMode == 0) { l_posHorz = 0xff; - } - else { - l_posHorz = maxcol; + } else { + l_posHorz = + g_eeGeneral.rotEncMode == ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_ALT + ? 0 + : maxcol; break; } #else @@ -388,7 +398,16 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t if (s_editMode>0) break; do { +#if defined(ROTARY_ENCODER_NAVIGATION) + if (g_eeGeneral.rotEncMode >= + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM) { + INC(l_posVert, 0, maxrow); + } else { + DEC(l_posVert, 0, maxrow); + } +#else DEC(l_posVert, 0, maxrow); +#endif } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); #if defined(ROTARY_ENCODER_NAVIGATION) diff --git a/radio/src/gui/navigation/navigation_x7.cpp b/radio/src/gui/navigation/navigation_x7.cpp index 4b2d03ecb6e..7af11abdb9a 100644 --- a/radio/src/gui/navigation/navigation_x7.cpp +++ b/radio/src/gui/navigation/navigation_x7.cpp @@ -344,7 +344,16 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t } do { +#if defined(ROTARY_ENCODER_NAVIGATION) + if (g_eeGeneral.rotEncMode >= + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM) { + DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } else { + INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } +#else INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1); +#endif } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); s_editMode = 0; // if we go down, we must be in this mode @@ -365,17 +374,31 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t DEC(l_posHorz, 0, maxcol); break; } - } - else if (l_posHorz > 0) { + } else if (l_posHorz > 0) { l_posHorz--; break; - } - else { + } else { +#if defined(ROTARY_ENCODER_NAVIGATION) + l_posHorz = + g_eeGeneral.rotEncMode == ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_ALT + ? 0 + : 0xff; +#else l_posHorz = 0xff; +#endif } do { +#if defined(ROTARY_ENCODER_NAVIGATION) + if (g_eeGeneral.rotEncMode >= + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM) { + INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } else { + DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } +#else DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1); +#endif } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); s_editMode = 0; // if we go up, we must be in this mode diff --git a/radio/src/gui/navigation/navigation_x9d.cpp b/radio/src/gui/navigation/navigation_x9d.cpp index 23006cbd2a9..98eb4dd4a91 100644 --- a/radio/src/gui/navigation/navigation_x9d.cpp +++ b/radio/src/gui/navigation/navigation_x9d.cpp @@ -439,7 +439,16 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t } do { - INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1); +#if defined(ROTARY_ENCODER_NAVIGATION) + if (g_eeGeneral.rotEncMode >= + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM) { + DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } else { + INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } +#else + DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); +#endif } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); s_editMode = 0; // if we go down, we must be in this mode @@ -458,17 +467,31 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t DEC(l_posHorz, 0, maxcol); break; } - } - else if (l_posHorz > 0) { + } else if (l_posHorz > 0) { l_posHorz--; break; - } - else { + } else { +#if defined(ROTARY_ENCODER_NAVIGATION) + l_posHorz = + g_eeGeneral.rotEncMode == ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_ALT + ? 0 + : 0xff; +#else l_posHorz = 0xff; +#endif } do { - DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1); +#if defined(ROTARY_ENCODER_NAVIGATION) + if (g_eeGeneral.rotEncMode >= + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM) { + INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } else { + DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); + } +#else + DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount - 1); +#endif } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); s_editMode = 0; // if we go up, we must be in this mode diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index fc0abe1e8f9..0e7948c0886 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -567,6 +567,26 @@ static int luaGetRotEncSpeed(lua_State * L) return 1; } +/*luadoc +@function getRotEncMode() + +Return rotary encoder mode + +@retval number in list: Normal = 0, Both V and H inverted = 1, V-N = 2, V-A = 3 + return 0 on radio without rotary encoder + +@status current Introduced in 2.8.0 +*/ +static int luaGetRotEncMode(lua_State * L) +{ +#if defined(ROTARY_ENCODER_NAVIGATION) + lua_pushunsigned(L, g_eeGeneral.rotEncMode); +#else + lua_pushunsigned(L, 0); +#endif + return 1; +} + /*luadoc @function sportTelemetryPop() @@ -1020,12 +1040,12 @@ static int luaGetFieldInfo(lua_State * L) { bool found; LuaField field; - + if (lua_type(L, 1) == LUA_TNUMBER) found = luaFindFieldById(luaL_checkinteger(L, 1), field, FIND_FIELD_DESC); else found = luaFindFieldByName(luaL_checkstring(L, 1), field, FIND_FIELD_DESC); - + if (found) { lua_newtable(L); lua_pushtableinteger(L, "id", field.id); @@ -1594,7 +1614,7 @@ static int luaPopupConfirmation(lua_State * L) warningText = nullptr; lua_pushnil(L); } - + return 1; } @@ -1996,7 +2016,7 @@ static int luaSerialWrite(lua_State * L) const char* p = str; while(wr_len--) _sendCb(_ctx, *p++); } - + return 0; } @@ -2055,7 +2075,7 @@ static int luaSerialRead(lua_State * L) static int shmVar[16] = {0}; /*luadoc -@function setShmVar(id, value) +@function setShmVar(id, value) @param id: integer between 1 and 16 identifying the shared memory variable. @@ -2072,10 +2092,10 @@ static int luaSetShmVar(lua_State * L) { int id = luaL_checkinteger(L, 1); int value = luaL_checkinteger(L, 2); - + if (1 <= id && id <= 16) shmVar[id - 1] = value; - + return 0; } @@ -2096,7 +2116,7 @@ Gets the value of a shared memory variable that can be used for passing data bet static int luaGetShmVar(lua_State * L) { int id = luaL_checkinteger(L, 1); - + if (1 <= id && id <= 16) lua_pushinteger(L, shmVar[id - 1]); else @@ -2107,14 +2127,14 @@ static int luaGetShmVar(lua_State * L) #endif /*luadoc -@function setStickySwitch(id, value) +@function setStickySwitch(id, value) @param id: integer identifying the sticky logical switch (zero for LS1 etc.). @param value: true/false. The new value of the sticky logical switch. -@retval bufferFull: true/false. This function sends a message from Lua to the logical switch processor -via a buffer with eight slots that are read 10 times per second. If the buffer is full, then a true value +@retval bufferFull: true/false. This function sends a message from Lua to the logical switch processor +via a buffer with eight slots that are read 10 times per second. If the buffer is full, then a true value is returned and no messages was sent (i.e. the switch was not changed). Sets the value of a sticky logical switch. @@ -2165,7 +2185,7 @@ static int luaGetLogicalSwitchValue(lua_State * L) /*luadoc @function getSwitchIndex(positionName) -@param positionName: string naming a switch position as it is shown on radio menus where you can select a switch. Notice that many names have +@param positionName: string naming a switch position as it is shown on radio menus where you can select a switch. Notice that many names have special characters in them like arrow up/down etc. @retval value: integer. The switchIndex, which can be used as input for `getSwitchName(switchIndex)` and `getSwitchValue(switchIndex)`. Also corresponds @@ -2180,12 +2200,12 @@ static int luaGetSwitchIndex(lua_State * L) bool negate = false; bool found = false; swsrc_t idx; - + if (name[0] == '!') { name++; negate = true; } - + for (idx = SWSRC_NONE; idx < SWSRC_COUNT; idx++) { if (isSwitchAvailable(idx, ModelCustomFunctionsContext)) { char* s = getSwitchPositionName(idx); @@ -2195,7 +2215,7 @@ static int luaGetSwitchIndex(lua_State * L) } } } - + if (found) { if (negate) idx = -idx; @@ -2210,7 +2230,7 @@ static int luaGetSwitchIndex(lua_State * L) /*luadoc @function getSwitchName(switchIndex) -@param switchIndex: integer identifying a switch as returned by `getSwitchIndex(positionName)` or fields in the table returned by +@param switchIndex: integer identifying a switch as returned by `getSwitchIndex(positionName)` or fields in the table returned by `model.getLogicalSwitch(switch)` identifying switches. @retval value: string naming the switch position as it is shown on radio menus where a switch can be chosen. @@ -2233,7 +2253,7 @@ static int luaGetSwitchName(lua_State * L) /*luadoc @function getSwitchValue(switchIndex) -@param switchIndex: integer identifying a switch as returned by `getSwitchIndex(positionName)` or fields in the table returned by +@param switchIndex: integer identifying a switch as returned by `getSwitchIndex(positionName)` or fields in the table returned by `model.getLogicalSwitch(switch)` identifying switches. @retval value: true/false. The value of the switch. @@ -2267,7 +2287,7 @@ static int luaNextSwitch(lua_State * L) { swsrc_t last = luaL_checkinteger(L, 1); swsrc_t idx = luaL_checkinteger(L, 2); - + while (++idx <= last) { if (isSwitchAvailable(idx, ModelCustomFunctionsContext)) { char* name = getSwitchPositionName(idx); @@ -2276,7 +2296,7 @@ static int luaNextSwitch(lua_State * L) return 2; } } - + lua_pushnil(L); return 1; } @@ -2285,7 +2305,7 @@ static int luaSwitches(lua_State * L) { swsrc_t first; swsrc_t last; - + if (lua_isnumber(L, 1)) { first = luaL_checkinteger(L, 1) - 1; if (first < SWSRC_FIRST - 1) @@ -2385,7 +2405,7 @@ static int luaNextSource(lua_State * L) { mixsrc_t last = luaL_checkinteger(L, 1); mixsrc_t idx = luaL_checkinteger(L, 2); - + while (++idx <= last) { if (isSourceAvailable(idx)) { char srcName[maxSourceNameLength]; @@ -2433,6 +2453,7 @@ const luaL_Reg opentxLib[] = { { "getGeneralSettings", luaGetGeneralSettings }, { "getGlobalTimer", luaGetGlobalTimer }, { "getRotEncSpeed", luaGetRotEncSpeed }, + { "getRotEncMode", luaGetRotEncMode }, { "getValue", luaGetValue }, { "getRAS", luaGetRAS }, { "getTxGPS", luaGetTxGPS }, diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index f6fdf9a5f9c..90d34c30903 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -597,7 +597,7 @@ void resetBacklightTimeout() uint16_t autoOff = g_eeGeneral.lightAutoOff; #if defined(COLORLCD) // prevent the timeout from being 0 seconds on color lcd radios - autoOff = std::max(1, autoOff); + autoOff = std::max(1, autoOff); #endif lightOffCounter = (autoOff*250) << 1; } @@ -1760,7 +1760,7 @@ void opentxInit() #endif // #if !defined(EEPROM) initSerialPorts(); - + currentSpeakerVolume = requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF; currentBacklightBright = requiredBacklightBright = g_eeGeneral.backlightBright; #if !defined(SOFTWARE_VOLUME) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index cc08195afb8..62ceacbdeef 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -212,6 +212,15 @@ #define RADIO_TOOLS #endif +#if defined(ROTARY_ENCODER_NAVIGATION) +enum RotaryEncoderMode { + ROTARY_ENCODER_MODE_NORMAL, + ROTARY_ENCODER_MODE_INVERT_BOTH, + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_NORM, + ROTARY_ENCODER_MODE_INVERT_VERT_HORZ_ALT +}; +#endif + // RESX range is used for internal calculation; The menu says -100.0 to 100.0; internally it is -1024 to 1024 to allow some optimizations #define RESX_SHIFT 10 #define RESX 1024 @@ -986,6 +995,9 @@ union ReusableBuffer struct { uint8_t stickMode; +#if defined(ROTARY_ENCODER_NAVIGATION) + uint8_t rotaryEncoderMode; +#endif } generalSettings; struct { diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 26e18515b59..efaaa956ad3 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -1807,6 +1807,13 @@ static void r_jitterFilter(void* user, uint8_t* data, uint32_t bitoffs, yaml_put_bits(data, i, bitoffs, 1); } +static void r_rotEncDirection(void* user, uint8_t* data, uint32_t bitoffs, + const char* val, uint8_t val_len) +{ + uint32_t i = yaml_str2uint(val, val_len); + yaml_put_bits(data, i, bitoffs, 2); +} + static void r_telemetryBaudrate(void* user, uint8_t* data, uint32_t bitoffs, const char* val, uint8_t val_len) { diff --git a/radio/src/storage/yaml/yaml_datastructs_nv14.cpp b/radio/src/storage/yaml/yaml_datastructs_nv14.cpp index b46583d7ea8..00c19e20be2 100644 --- a/radio/src/storage/yaml/yaml_datastructs_nv14.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_nv14.cpp @@ -367,7 +367,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -437,9 +437,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_STRING("themeName", 8), YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), YAML_UNSIGNED( "stickDeadZone", 3 ), - YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_t12.cpp b/radio/src/storage/yaml/yaml_datastructs_t12.cpp index 2b70734ca38..cb3bb2012b7 100644 --- a/radio/src/storage/yaml/yaml_datastructs_t12.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_t12.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_t8.cpp b/radio/src/storage/yaml/yaml_datastructs_t8.cpp index 1c1e51a0b5e..2e28dd40af2 100644 --- a/radio/src/storage/yaml/yaml_datastructs_t8.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_t8.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_tlite.cpp b/radio/src/storage/yaml/yaml_datastructs_tlite.cpp index 1c1e51a0b5e..2e28dd40af2 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tlite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tlite.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_tpro.cpp b/radio/src/storage/yaml/yaml_datastructs_tpro.cpp index f87877dde6c..8930c312e2b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tpro.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tpro.cpp @@ -346,7 +346,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -412,8 +412,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 96 ), YAML_PADDING( 144 ), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_tx12.cpp b/radio/src/storage/yaml/yaml_datastructs_tx12.cpp index 4675fb7d48c..42344031841 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tx12.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tx12.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp b/radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp index 023554db743..b7d662a1dc6 100755 --- a/radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tx12mk2.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_x10.cpp b/radio/src/storage/yaml/yaml_datastructs_x10.cpp index 6e6bb0331cb..f0559f16f65 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x10.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x10.cpp @@ -390,7 +390,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -460,8 +460,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_STRING("themeName", 8), YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_SIGNED( "imuMax", 8 ), YAML_SIGNED( "imuOffset", 8 ), YAML_END diff --git a/radio/src/storage/yaml/yaml_datastructs_x12s.cpp b/radio/src/storage/yaml/yaml_datastructs_x12s.cpp index d577663299f..4d33502694d 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x12s.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x12s.cpp @@ -388,7 +388,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -458,8 +458,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_STRING("themeName", 8), YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_SIGNED( "imuMax", 8 ), YAML_SIGNED( "imuOffset", 8 ), YAML_END diff --git a/radio/src/storage/yaml/yaml_datastructs_x7.cpp b/radio/src/storage/yaml/yaml_datastructs_x7.cpp index 1c1e51a0b5e..2e28dd40af2 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x7.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x7.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_x9d.cpp b/radio/src/storage/yaml/yaml_datastructs_x9d.cpp index 1155766050f..955051bc673 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9d.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9d.cpp @@ -345,7 +345,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -413,8 +413,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_x9e.cpp b/radio/src/storage/yaml/yaml_datastructs_x9e.cpp index dc646a94fd4..85758f60d1e 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9e.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9e.cpp @@ -384,7 +384,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -452,8 +452,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp b/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp index ba8177b8074..6989cae15fd 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp @@ -325,7 +325,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -391,8 +391,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 120 ), YAML_PADDING( 120 ), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp b/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp index 68ec608a494..c314e4ea1ce 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp @@ -333,7 +333,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -401,8 +401,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_xlite.cpp b/radio/src/storage/yaml/yaml_datastructs_xlite.cpp index ba8b1023b62..9af3a866dcf 100644 --- a/radio/src/storage/yaml/yaml_datastructs_xlite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_xlite.cpp @@ -330,7 +330,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -398,8 +398,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/storage/yaml/yaml_datastructs_xlites.cpp b/radio/src/storage/yaml/yaml_datastructs_xlites.cpp index 8877a3e3608..05756c45a0b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_xlites.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_xlites.cpp @@ -332,7 +332,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -400,8 +400,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_SIGNED( "imuMax", 8 ), YAML_SIGNED( "imuOffset", 8 ), YAML_END diff --git a/radio/src/storage/yaml/yaml_datastructs_zorro.cpp b/radio/src/storage/yaml/yaml_datastructs_zorro.cpp index 023554db743..b7d662a1dc6 100644 --- a/radio/src/storage/yaml/yaml_datastructs_zorro.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_zorro.cpp @@ -338,7 +338,7 @@ static const struct YamlNode struct_RadioData[] = { YAML_ENUM("antennaMode", 2, enum_AntennaModes), YAML_UNSIGNED( "disableRtcWarning", 1 ), YAML_UNSIGNED( "keysBacklight", 1 ), - YAML_SIGNED( "rotEncDirection", 1 ), + YAML_PADDING( 1 ), YAML_ENUM("internalModule", 8, enum_ModuleType), YAML_STRUCT("trainer", 128, struct_TrainerData, NULL), YAML_UNSIGNED( "view", 8 ), @@ -406,8 +406,11 @@ static const struct YamlNode struct_RadioData[] = { YAML_PADDING( 8 ), YAML_STRING("bluetoothName", 10), YAML_STRING("ownerRegistrationID", 8), + YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr), + YAML_UNSIGNED( "rotEncMode", 2 ), YAML_SIGNED( "uartSampleMode", 2 ), - YAML_PADDING( 6 ), + YAML_PADDING( 3 ), + YAML_PADDING( 1 ), YAML_END }; static const struct YamlNode struct_unsigned_8[] = { diff --git a/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp b/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp index 95076d991f7..fc8265f68f4 100644 --- a/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp +++ b/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp @@ -82,8 +82,10 @@ void rotaryEncoderInit() #define INC_ROT 1 #define INC_ROT_2 2 #else -#define INC_ROT (g_eeGeneral.rotEncDirection ? -1 : 1); -#define INC_ROT_2 (g_eeGeneral.rotEncDirection ? -2 : 2); +#define INC_ROT \ + (g_eeGeneral.rotEncMode == ROTARY_ENCODER_MODE_INVERT_BOTH ? -1 : 1); +#define INC_ROT_2 \ + (g_eeGeneral.rotEncMode == ROTARY_ENCODER_MODE_INVERT_BOTH ? -2 : 2); #endif void rotaryEncoderCheck() diff --git a/radio/src/targets/simu/opentxsimulator.cpp b/radio/src/targets/simu/opentxsimulator.cpp index 13243df215c..6853385ef85 100644 --- a/radio/src/targets/simu/opentxsimulator.cpp +++ b/radio/src/targets/simu/opentxsimulator.cpp @@ -276,8 +276,8 @@ void OpenTxSimulator::setInputValue(int type, uint8_t index, int16_t value) void OpenTxSimulator::rotaryEncoderEvent(int steps) { #if defined(ROTARY_ENCODER_NAVIGATION) - (g_eeGeneral.rotEncDirection ? steps *= -1 : steps); - + (g_eeGeneral.rotEncMode >= ROTARY_ENCODER_MODE_INVERT_BOTH ? steps *= -1 + : steps); ROTARY_ENCODER_NAVIGATION_VALUE += steps * ROTARY_ENCODER_GRANULARITY; #else // TODO : this should probably be handled in the GUI diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 798b9964444..0d6ea939680 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -53,6 +53,7 @@ ISTR(VTELEMSCREENTYPE); ISTR(VKEYS); ISTR(VSWITCHES); ISTR(VSRCRAW); +ISTR(ROTARY_ENC_OPT); ISTR(VTMRMODES); ISTR(VPERSISTENT); ISTR(VUNITSSYSTEM); @@ -477,7 +478,7 @@ const char STR_OWN[] = TR_OWN; const char STR_DATE[] = TR_DATE; const char STR_CHANNELS_MONITOR[] = TR_CHANNELS_MONITOR; const char STR_ROTARY_ENCODER[] = TR_ROTARY_ENCODER; -const char STR_INVERT_ROTARY[] = TR_INVERT_ROTARY; +const char STR_ROTARY_ENC_MODE[] = TR_ROTARY_ENC_MODE; const char STR_MIXERS_MONITOR[] = TR_MIXERS_MONITOR; const char STR_PATH_TOO_LONG[] = TR_PATH_TOO_LONG; const char STR_VIEW_TEXT[] = TR_VIEW_TEXT; diff --git a/radio/src/translations.h b/radio/src/translations.h index 8172287e2ce..4105336fa0e 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -138,6 +138,8 @@ extern const char* STR_VKEYS[]; extern const char* STR_VSWITCHES[]; extern const char* STR_VSRCRAW[]; +extern const char* STR_ROTARY_ENC_OPT[]; + #if defined(TRANSLATIONS_CZ) extern const char* STR_INPUTNAMES[]; #endif @@ -727,7 +729,7 @@ extern const char STR_GLOBAL_VAR[]; extern const char STR_OWN[]; extern const char STR_DATE[]; extern const char STR_ROTARY_ENCODER[]; -extern const char STR_INVERT_ROTARY[]; +extern const char STR_ROTARY_ENC_MODE[]; extern const char STR_CHANNELS_MONITOR[]; extern const char STR_MIXERS_MONITOR[]; extern const char STR_PATH_TOO_LONG[]; diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index a4bef6de8cf..99a6a7180a3 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -219,6 +219,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -748,7 +754,7 @@ #define TR_DATE "日期" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } #define TR_ROTARY_ENCODER "滚轮" -#define TR_INVERT_ROTARY "滚轮反向" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "通道查看器" #define TR_MIXERS_MONITOR "混控查看器" #define TR_PATH_TOO_LONG "路径太长" diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index 925ecda9d4f..24fba8479aa 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -236,6 +236,12 @@ #define TR_ON_ONE_SWITCHES "ZAP","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -763,7 +769,7 @@ #define TR_DATE "Datum" #define TR_MONTHS { "Led", "Úno", "Bře", "Dub", "Kvě", "Čvn", "Čvc", "Srp", "Zář", "Říj", "Lis", "Pro" } #define TR_ROTARY_ENCODER "R.Enko" -#define TR_INVERT_ROTARY "Invertovat kolečko" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "MONITOR KANÁLU" #define TR_MIXERS_MONITOR "MONITOR MIXU" #define TR_PATH_TOO_LONG "Cesta je moc dlouhá" diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index 75164cb8892..3038f17f79d 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -748,7 +748,7 @@ #define TR_DATE "Dato" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec" } #define TR_ROTARY_ENCODER "R.E." -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "KANAL MONITOR" #define TR_MIXERS_MONITOR "MIX MONITOR" #define TR_PATH_TOO_LONG "Sti for lang" diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index a4aacc7e6af..e653aebe9f2 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -221,6 +221,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -746,7 +752,7 @@ #define TR_DATE "Datum:" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez" } #define TR_ROTARY_ENCODER "Drehgeber" -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "Kanal-Monitor==>" #define TR_MIXERS_MONITOR "==>Mischer Monitor" #define TR_PATH_TOO_LONG "Pfad zu Lang" diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index c99010d4372..9a6e5bfa68a 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -219,6 +219,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -748,7 +754,7 @@ #define TR_DATE "Date" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } #define TR_ROTARY_ENCODER "R.E." -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "CHANNELS MONITOR" #define TR_MIXERS_MONITOR "MIXERS MONITOR" #define TR_PATH_TOO_LONG "Path too long" diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index 264af13d772..1aba350771a 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -218,6 +218,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -747,7 +753,7 @@ #define TR_DATE "Fecha" #define TR_MONTHS { "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" } #define TR_ROTARY_ENCODER "R.E." -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "MONITOR CANALES" #define TR_MIXERS_MONITOR "MONITOR MEZCLAS" #define TR_PATH_TOO_LONG "Path muy largo" diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index 30066c04391..9de9957aa7e 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -233,8 +233,15 @@ #define TR_ROTARY_ENCODERS #define TR_ROTENC_SWITCHES + #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -748,6 +755,7 @@ #define TR_DATE "Päivämäärä" #define TR_MONTHS { "tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou" } #define TR_ROTARY_ENCODER "R.E." +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "CHANNELS MONITOR" #define TR_MIXERS_MONITOR "MIXERS MONITOR" #define TR_PATH_TOO_LONG "Polku liian pitkä" diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index f2905a710df..7cf3b05c5fd 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -239,6 +239,12 @@ #define TR_ON_ONE_SWITCHES "ON","Un" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -766,7 +772,7 @@ #define TR_DATE "Date" #define TR_MONTHS { "Jan", "Fév", "Mar", "Avr", "Mai", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec" } #define TR_ROTARY_ENCODER "Enc.Rot." -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "MONITEUR CANAUX" #define TR_MIXERS_MONITOR "MONITEUR MIXAGES " #define TR_PATH_TOO_LONG "Chemin trop long" diff --git a/radio/src/translations/it.h b/radio/src/translations/it.h index 8d7360c93b9..c4ac951a42d 100644 --- a/radio/src/translations/it.h +++ b/radio/src/translations/it.h @@ -223,6 +223,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -746,7 +752,7 @@ #define TR_DATE "Data" #define TR_MONTHS { "Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic" } #define TR_ROTARY_ENCODER "R.E." -#define TR_INVERT_ROTARY "Inverti Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "MONITOR CANALI" #define TR_MIXERS_MONITOR "MONITOR MIXER" #define TR_PATH_TOO_LONG "Path troppo lungo" diff --git a/radio/src/translations/nl.h b/radio/src/translations/nl.h index a805a30b344..9c16b86f7db 100644 --- a/radio/src/translations/nl.h +++ b/radio/src/translations/nl.h @@ -222,6 +222,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -754,7 +760,7 @@ #define TR_DATE "Datum:" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec" } #define TR_ROTARY_ENCODER "Draaischakelaar" -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "Kanaal-Monitor==>" #define TR_MIXERS_MONITOR "==>MIXERS MONitor" #define TR_PATH_TOO_LONG "Pad te Lang" diff --git a/radio/src/translations/pl.h b/radio/src/translations/pl.h index 279dedddfa6..6ed0b74bc3d 100644 --- a/radio/src/translations/pl.h +++ b/radio/src/translations/pl.h @@ -216,7 +216,13 @@ #define TR_ROTARY_ENCODERS #define TR_ROTENC_SWITCHES -#define TR_ON_ONE_SWITCHES "ON","One" +#define TR_ON_ONE_SWITCHES "ON","One" + +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", @@ -742,7 +748,7 @@ #define TR_DATE "Data" #define TR_MONTHS { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } #define TR_ROTARY_ENCODER "R.E." -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "MONITOR KANAŁÓW" #define TR_MIXERS_MONITOR "MONITOR MIKSER" #define TR_PATH_TOO_LONG "Ścieżka za długa" diff --git a/radio/src/translations/pt.h b/radio/src/translations/pt.h index 3971541536f..d39cdca59fa 100644 --- a/radio/src/translations/pt.h +++ b/radio/src/translations/pt.h @@ -215,6 +215,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -747,7 +753,7 @@ #define TR_DATE "Data" #define TR_MONTHS { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } #define TR_ROTARY_ENCODER "R.E." -#define TR_INVERT_ROTARY "Invert Rotary" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "CHANNELS MONITOR" #define TR_MIXERS_MONITOR "MIXERS MONITOR" #define TR_PATH_TOO_LONG "Path too long" diff --git a/radio/src/translations/se.h b/radio/src/translations/se.h index 4d9cc11cd55..0c2373a870a 100644 --- a/radio/src/translations/se.h +++ b/radio/src/translations/se.h @@ -70,7 +70,7 @@ #else #define TR_RETA123 "R","H","G","S","1","2","3" #endif - + #define TR_VCURVEFUNC "---","x>0","x<0","|x|","f>0","f<0","|f|" #define TR_VMLTPX "Addera","Förstärk","Ersätt" #define TR_VMLTPX2 "+=","*=",":=" @@ -234,11 +234,16 @@ #endif #define TR_ROTARY_ENCODERS -#define TR_INVERT_ROTARY "Invertera rullhjul" #define TR_ROTENC_SWITCHES #define TR_ON_ONE_SWITCHES "PÅ","Ett" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -776,6 +781,7 @@ #define TR_DATE "Datum" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec" } #define TR_ROTARY_ENCODER "R.H." +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "Kanalöversikt" #define TR_MIXERS_MONITOR "MIXERSKÄRM" #define TR_PATH_TOO_LONG "För lång sökväg" diff --git a/radio/src/translations/tw.h b/radio/src/translations/tw.h index e70ccff8b5e..b79663e2e6a 100644 --- a/radio/src/translations/tw.h +++ b/radio/src/translations/tw.h @@ -219,6 +219,12 @@ #define TR_ON_ONE_SWITCHES "ON","One" +#if defined(COLORLCD) + #define TR_ROTARY_ENC_OPT "Normal","Inverted" +#else + #define TR_ROTARY_ENC_OPT "Normal","Inverted","V-I H-N","V-I H-A" +#endif + #if defined(IMU) #define TR_IMU_VSRCRAW "TltX","TltY", #else @@ -748,7 +754,7 @@ #define TR_DATE "日期" #define TR_MONTHS { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec " } #define TR_ROTARY_ENCODER "滾輪" -#define TR_INVERT_ROTARY "滾輪反向" +#define TR_ROTARY_ENC_MODE TR("RotEnc Mode","Rotary Encoder Mode") #define TR_CHANNELS_MONITOR "通道查看器" #define TR_MIXERS_MONITOR "混控查看器" #define TR_PATH_TOO_LONG "路徑太長"