From 0eeb0437dba82570a0c323f7c28c84306c8f5c94 Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 9 Mar 2015 18:49:10 +0100 Subject: [PATCH] [Taranis X9E] Pots and Switches full support. Removed 2x2 switches feature --- radio/src/eeprom_conversions.cpp | 12 +- radio/src/gui/Taranis/helpers.cpp | 19 +-- radio/src/gui/Taranis/menu_general_calib.cpp | 2 +- .../src/gui/Taranis/menu_general_hardware.cpp | 51 +++--- radio/src/gui/Taranis/menu_model_setup.cpp | 148 ++++++++++++------ radio/src/gui/Taranis/view_main.cpp | 32 ++-- radio/src/mixer.cpp | 6 - radio/src/myeeprom.h | 118 +++++++------- radio/src/opentx.cpp | 8 +- radio/src/opentx.h | 20 +-- radio/src/simu.cpp | 22 +-- radio/src/switches.cpp | 42 ++--- radio/src/targets/simu/simpgmspace.cpp | 29 ++-- radio/src/translations.cpp | 9 ++ radio/src/translations.h | 17 +- radio/src/translations/en.h.txt | 39 +++-- 16 files changed, 318 insertions(+), 256 deletions(-) diff --git a/radio/src/eeprom_conversions.cpp b/radio/src/eeprom_conversions.cpp index 9d3c67a18..5067a2241 100644 --- a/radio/src/eeprom_conversions.cpp +++ b/radio/src/eeprom_conversions.cpp @@ -837,9 +837,6 @@ int ConvertSwitch_216_to_217(int swtch) #if defined(REV9E) if (swtch >= SWSRC_SI0) swtch += 10*2; -#else - if (swtch >= SWSRC_SI0) - swtch += 6*2; #endif return swtch; @@ -857,10 +854,6 @@ int ConvertSource_216_to_217(int source) // SI to SR switches added if (source >= MIXSRC_SI) source += 10; -#elif defined(PCBTARANIS) - // SI to SN switches added - if (source >= MIXSRC_SI) - source += 6; #endif // Telemetry conversions if (source >= MIXSRC_FIRST_TELEM) @@ -1465,8 +1458,9 @@ void ConvertModel_216_to_217(ModelData &model) memcpy(newModel.curveNames, oldModel.curveNames, sizeof(newModel.curveNames)); memcpy(newModel.inputNames, oldModel.inputNames, sizeof(newModel.inputNames)); #endif - newModel.nPotsToWarn = oldModel.nPotsToWarn; - memcpy(newModel.potPosition, oldModel.potPosition, sizeof(newModel.potPosition)); + newModel.potsWarnMode = oldModel.nPotsToWarn >> 6; + newModel.potsWarnEnabled = oldModel.nPotsToWarn & 0x1f; + memcpy(newModel.potsWarnPosition, oldModel.potPosition, sizeof(newModel.potsWarnPosition)); } void ConvertModel(int id, int version) diff --git a/radio/src/gui/Taranis/helpers.cpp b/radio/src/gui/Taranis/helpers.cpp index 0bdabf598..0fe9e9f84 100755 --- a/radio/src/gui/Taranis/helpers.cpp +++ b/radio/src/gui/Taranis/helpers.cpp @@ -109,12 +109,6 @@ bool isSourceAvailable(int source) return false; } - if (source>=MIXSRC_SI && source<=MIXSRC_SN) { - if (!IS_2x2POS(source-MIXSRC_SI)) { - return false; - } - } - if (source>=MIXSRC_SW1 && source<=MIXSRC_LAST_LOGICAL_SWITCH) { LogicalSwitchData * cs = lswAddress(source-MIXSRC_SW1); return (cs->func != LS_FUNC_NONE); @@ -204,19 +198,16 @@ bool isSwitchAvailable(int swtch, SwitchContext context) } #if defined(REV9E) - if (swtch >= SWSRC_SA1 && swtch <= SWSRC_SR1 && (swtch-SWSRC_SA1)%3 == 0) { - return IS_3POS(index); + if (swtch >= SWSRC_SA0 && swtch <= SWSRC_SR2) { + if (!SWITCH_EXISTS(index)) + return false; + if ((swtch-SWSRC_SA1)%3 == 0) + return IS_3POS(index); } #else if (swtch == SWSRC_SA1 || swtch == SWSRC_SB1 || swtch == SWSRC_SC1 || swtch == SWSRC_SD1 || swtch == SWSRC_SE1 || swtch == SWSRC_SG1) { return IS_3POS(index); } - if (swtch >= SWSRC_SI0 && swtch <= SWSRC_SM2) { - return IS_2x2POS((swtch-SWSRC_SI0)/2); - } - if (swtch >= SWSRC_SN0 && swtch <= SWSRC_SN2) { - return IS_2x2POS(6); - } #endif if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH && swtch <= SWSRC_LAST_MULTIPOS_SWITCH) { diff --git a/radio/src/gui/Taranis/menu_general_calib.cpp b/radio/src/gui/Taranis/menu_general_calib.cpp index 7ac363018..200fce043 100755 --- a/radio/src/gui/Taranis/menu_general_calib.cpp +++ b/radio/src/gui/Taranis/menu_general_calib.cpp @@ -154,7 +154,7 @@ void menuCommonCalib(uint8_t event) } } else { - g_eeGeneral.potsType &= ~(0x03<<(2*idx)); + g_eeGeneral.potsConfig &= ~(0x03<<(2*idx)); } } } diff --git a/radio/src/gui/Taranis/menu_general_hardware.cpp b/radio/src/gui/Taranis/menu_general_hardware.cpp index 63b54f4fa..db379e1fd 100755 --- a/radio/src/gui/Taranis/menu_general_hardware.cpp +++ b/radio/src/gui/Taranis/menu_general_hardware.cpp @@ -60,12 +60,12 @@ enum menuGeneralHwItems { ITEM_SETUP_HW_SF, ITEM_SETUP_HW_SG, ITEM_SETUP_HW_SH, - ITEM_SETUP_HW_SI, - ITEM_SETUP_HW_SJ, - ITEM_SETUP_HW_SK, - ITEM_SETUP_HW_SL, - ITEM_SETUP_HW_SM, - ITEM_SETUP_HW_SN, + CASE_REV9E(ITEM_SETUP_HW_SI) + CASE_REV9E(ITEM_SETUP_HW_SJ) + CASE_REV9E(ITEM_SETUP_HW_SK) + CASE_REV9E(ITEM_SETUP_HW_SL) + CASE_REV9E(ITEM_SETUP_HW_SM) + CASE_REV9E(ITEM_SETUP_HW_SN) CASE_REV9E(ITEM_SETUP_HW_SO) CASE_REV9E(ITEM_SETUP_HW_SP) CASE_REV9E(ITEM_SETUP_HW_SQ) @@ -87,8 +87,7 @@ enum menuGeneralHwItems { #if defined(REV9E) #define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #else - #define SWITCH_ROWS(x) uint8_t(IS_2x2POS(x) ? 0 : HIDDEN_ROW) - #define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, SWITCH_ROWS(0), SWITCH_ROWS(1), SWITCH_ROWS(2), SWITCH_ROWS(3), SWITCH_ROWS(4), SWITCH_ROWS(6) + #define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #endif void menuGeneralHardware(uint8_t event) @@ -107,7 +106,7 @@ void menuGeneralHardware(uint8_t event) LcdFlags attr = (sub == k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); switch (k) { case ITEM_SETUP_HW_LABEL_STICKS: - lcd_putsLeft(y, "Sticks"); + lcd_putsLeft(y, STR_STICKS); break; case ITEM_SETUP_HW_STICK1: case ITEM_SETUP_HW_STICK2: @@ -129,7 +128,7 @@ void menuGeneralHardware(uint8_t event) break; } case ITEM_SETUP_HW_LABEL_POTS: - lcd_putsLeft(y, "Pots"); + lcd_putsLeft(y, STR_POTS); break; case ITEM_SETUP_HW_POT1: case ITEM_SETUP_HW_POT2: @@ -149,18 +148,22 @@ void menuGeneralHardware(uint8_t event) else lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); - uint8_t potType = (g_eeGeneral.potsType & mask) >> shift; + uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift; +#if !defined(REV9E) if (potType == POT_TYPE_NONE && k <= ITEM_SETUP_HW_POT2) potType = POT_TYPE_DETENT; +#endif potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, 0, POT_TYPE_MAX, m_posHorz == 1 ? attr : 0, event); +#if !defined(REV9E) if (potType == POT_TYPE_DETENT && k <= ITEM_SETUP_HW_POT2) potType = POT_TYPE_NONE; - g_eeGeneral.potsType &= ~mask; - g_eeGeneral.potsType |= (potType << shift); +#endif + g_eeGeneral.potsConfig &= ~mask; + g_eeGeneral.potsConfig |= (potType << shift); break; } case ITEM_SETUP_HW_LABEL_SWITCHES: - lcd_putsLeft(y, "Switches"); + lcd_putsLeft(y, STR_SWITCHES); break; case ITEM_SETUP_HW_SA: case ITEM_SETUP_HW_SB: @@ -170,13 +173,13 @@ void menuGeneralHardware(uint8_t event) case ITEM_SETUP_HW_SF: case ITEM_SETUP_HW_SG: case ITEM_SETUP_HW_SH: +#if defined(REV9E) case ITEM_SETUP_HW_SI: case ITEM_SETUP_HW_SJ: case ITEM_SETUP_HW_SK: case ITEM_SETUP_HW_SL: case ITEM_SETUP_HW_SM: case ITEM_SETUP_HW_SN: -#if defined(REV9E) case ITEM_SETUP_HW_SO: case ITEM_SETUP_HW_SP: case ITEM_SETUP_HW_SQ: @@ -193,20 +196,16 @@ void menuGeneralHardware(uint8_t event) else lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); #if defined(REV9E) - config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", "\007None\0 DefaultToggle\0""2POS\0 3POS\0", config, SWITCH_NONE, SWITCH_3POS, m_posHorz == 1 ? attr : 0, event); + config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_3POS, m_posHorz == 1 ? attr : 0, event); if (attr && checkIncDec_Ret) { - uint32_t mask = 0x0f << (4*index); - TRACE("avant %x", g_eeGeneral.switchConfig); - g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((uint32_t(config)&0xf) << (4*index)); - TRACE("apres %x", g_eeGeneral.switchConfig); + uint64_t mask = (uint64_t)0x07 << (3*index); + g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((uint64_t(config) & 0x07) << (3*index)); } #else - if (k <= ITEM_SETUP_HW_SH) { - config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", "\007DefaultToggle\0""2POS\0 3POS\0 2x2POS\0", config, SWITCH_NONE, SWITCH_2x2POS, m_posHorz == 1 ? attr : 0, event); - if (attr && checkIncDec_Ret) { - uint32_t mask = 0x0f << (4*index); - g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | (((uint32_t)(config)&0xf) << (4*index)); - } + config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_SWTYPES, config, SWITCH_DEFAULT, SWITCH_3POS, m_posHorz == 1 ? attr : 0, event); + if (attr && checkIncDec_Ret) { + uint32_t mask = 0x03 << (2*index); + g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | (((uint32_t)(config) & 0x03) << (2*index)); } #endif break; diff --git a/radio/src/gui/Taranis/menu_model_setup.cpp b/radio/src/gui/Taranis/menu_model_setup.cpp index fb930a577..b54cb0eb2 100644 --- a/radio/src/gui/Taranis/menu_model_setup.cpp +++ b/radio/src/gui/Taranis/menu_model_setup.cpp @@ -72,8 +72,14 @@ enum menuModelSetupItems { ITEM_MODEL_CHECKLIST_DISPLAY, ITEM_MODEL_THROTTLE_WARNING, ITEM_MODEL_SWITCHES_WARNING, +#if defined(REV9E) ITEM_MODEL_SWITCHES_WARNING2, - ITEM_MODEL_POT_WARNING, + ITEM_MODEL_SWITCHES_WARNING3, +#endif + ITEM_MODEL_POTS_WARNING, +#if defined(REV9E) + ITEM_MODEL_POTS_WARNING2, +#endif ITEM_MODEL_BEEP_CENTER, ITEM_MODEL_USE_GLOBAL_FUNCTIONS, ITEM_MODEL_INTERNAL_MODULE_LABEL, @@ -95,7 +101,7 @@ enum menuModelSetupItems { #define FIELD_PROTOCOL_MAX 1 -#define MODEL_SETUP_2ND_COLUMN (LCD_W-17*FW-MENUS_SCROLLBAR_WIDTH) +#define MODEL_SETUP_2ND_COLUMN (LCD_W-17*FW-MENUS_SCROLLBAR_WIDTH-1) #define MODEL_SETUP_BIND_OFS 3*FW-2 #define MODEL_SETUP_RANGE_OFS 7*FW #define MODEL_SETUP_SET_FAILSAFE_OFS 10*FW @@ -181,17 +187,23 @@ void menuModelSetup(uint8_t event) #define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1) #define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS() : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS() : TRAINER_CHANNELS_ROWS())) #define FAILSAFE_ROWS(x) ((g_model.moduleData[x].rfProtocol==RF_PROTO_X16 || g_model.moduleData[x].rfProtocol==RF_PROTO_LR12) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW) - #define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0) #define TIMER_ROWS 2|NAVIGATION_LINE_BY_LINE, 0, CASE_PERSISTENT_TIMERS(0) 0, 0 #if TIMERS == 1 - #define TIMERS_ROWS TIMER_ROWS + #define TIMERS_ROWS TIMER_ROWS #elif TIMERS == 2 - #define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS + #define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS #elif TIMERS == 3 - #define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS, TIMER_ROWS + #define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS, TIMER_ROWS + #endif + #if defined(REV9E) + #define SW_WARN_ITEMS() uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsAllowed()), uint8_t(getSwitchWarningsAllowed() > 8 ? TITLE_ROW : HIDDEN_ROW), uint8_t(getSwitchWarningsAllowed() > 16 ? TITLE_ROW : HIDDEN_ROW) + #define POT_WARN_ITEMS() uint8_t(g_model.potsWarnMode ? NAVIGATION_LINE_BY_LINE|NUM_POTS : 0), uint8_t(g_model.potsWarnMode ? TITLE_ROW : HIDDEN_ROW) + #else + #define SW_WARN_ITEMS() uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsAllowed()) + #define POT_WARN_ITEMS() uint8_t(g_model.potsWarnMode ? NAVIGATION_LINE_BY_LINE|NUM_POTS : 0) #endif bool CURSOR_ON_CELL = (m_posHorz >= 0); - MENU_TAB({ 0, 0, TIMERS_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsAllowed()), ONE_2x2POS_DEFINED() ? TITLE_ROW : HIDDEN_ROW, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)}); + MENU_TAB({ 0, 0, TIMERS_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)}); MENU_CHECK(STR_MENUSETUP, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX); @@ -204,7 +216,7 @@ void menuModelSetup(uint8_t event) int sub = m_posVert; - for (uint8_t i=0; i=NUM_BODY_LINES-2 && getSwitchWarningsAllowed() > 8*(NUM_BODY_LINES-i)) { + if (CURSOR_MOVED_LEFT(event)) + s_pgOfs--; + else + s_pgOfs++; break; } - { +#endif lcd_putsLeft(y, STR_SWITCHWARNING); swarnstate_t states = g_model.switchWarningState; char c; @@ -407,9 +431,10 @@ void menuModelSetup(uint8_t event) LcdFlags line = attr; - for (int i=0, current=0; i>= 2; } if (attr && m_posHorz < 0) { - drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), ONE_2x2POS_DEFINED() ? 2*FH+1 : FH+1); +#if defined(REV9E) + drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), 1+FH*((current+7)/8)); +#else + drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, current*(2*FW+1), FH+1); +#endif } break; } - case ITEM_MODEL_POT_WARNING: - { + case ITEM_MODEL_POTS_WARNING: +#if defined(REV9E) + if (i==NUM_BODY_LINES-1 && g_model.potsWarnMode) { + if (CURSOR_MOVED_LEFT(event)) + s_pgOfs--; + else + s_pgOfs++; + break; + } +#endif + lcd_putsLeft(y, STR_POTWARNING); - uint8_t potMode = g_model.nPotsToWarn >> 6; + lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (m_posHorz == 0) ? attr : 0); + if (attr && (m_posHorz == 0)) { + CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO); + eeDirty(EE_MODEL); + } + if (attr) { - if (m_posHorz) s_editMode = 0; - if (!READ_ONLY() && m_posHorz) { + if (m_posHorz > 0) s_editMode = 0; + if (!READ_ONLY() && m_posHorz > 0) { switch (event) { case EVT_KEY_LONG(KEY_ENTER): killEvents(event); - if (potMode == 1) { + if (g_model.potsWarnMode == POTS_WARN_MANUAL) { SAVE_POT_POSITION(m_posHorz-1); AUDIO_WARNING1(); eeDirty(EE_MODEL); } break; case EVT_KEY_BREAK(KEY_ENTER): - g_model.nPotsToWarn ^= (1 << (m_posHorz-1)); + g_model.potsWarnEnabled ^= (1 << (m_posHorz-1)); eeDirty(EE_MODEL); break; } } } - lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), potMode, (m_posHorz == 0) ? attr : 0); - if (potMode) { - coord_t x = MODEL_SETUP_2ND_COLUMN+5*FW; + if (g_model.potsWarnMode) { + coord_t x = MODEL_SETUP_2ND_COLUMN+27; for (int i=0; i= 0) && !(g_model.potsWarnEnabled & (1 << i))) { + flags |= INVERS; + } lcd_putsiAtt(x, y, STR_VSRCRAW, NUM_STICKS+1+i, flags); + +#if defined(REV9E) + if (i == NUM_XPOTS-1) { + y += FH; + x = MODEL_SETUP_2ND_COLUMN+27; + } + else { + x += (2*FW+7); + } +#else x += (2*FW+3); +#endif } } - - if (attr && (m_posHorz == 0)) { - CHECK_INCDEC_MODELVAR(event, potMode, 0, 2); - g_model.nPotsToWarn = (g_model.nPotsToWarn & 0x3F) | ((potMode << 6) & 0xC0); - eeDirty(EE_MODEL); + if (attr && m_posHorz < 0) { +#if defined(REV9E) + drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-FH-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, 2*FH+1); +#else + drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1); +#endif } break; - } case ITEM_MODEL_BEEP_CENTER: + { lcd_putsLeft(y, STR_BEEPCTR); - for (uint8_t i=0; i=POT1 && i POT3) { - x -= FW; - } -#endif lcd_putsiAtt(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<= 0) { - lcd_hline(x, y, width); - lcd_hline(x, y+2, width); - y += 4; - if (val > 0) { + if (val >= 0) { lcd_hline(x, y, width); lcd_hline(x, y+2, width); y += 4; + if (val > 0) { + lcd_hline(x, y, width); + lcd_hline(x, y+2, width); + y += 4; + } } - } - lcd_putcAtt(width==5 ? x+1 : x, y, 'A'+index, TINSIZE); - y += 6; + lcd_putcAtt(width==5 ? x+1 : x, y, 'A'+index, TINSIZE); + y += 6; - if (val <= 0) { - lcd_hline(x, y, width); - lcd_hline(x, y+2, width); - if (val < 0) { - lcd_hline(x, y+4, width); - lcd_hline(x, y+6, width); + if (val <= 0) { + lcd_hline(x, y, width); + lcd_hline(x, y+2, width); + if (val < 0) { + lcd_hline(x, y+4, width); + lcd_hline(x, y+6, width); + } } } } diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index abac6e89a..dff2cb1ed 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -303,12 +303,6 @@ getvalue_t getValue(mixsrc_t i) else if (i==MIXSRC_SR) return (switchState(SW_SR0) ? -1024 : (switchState(SW_SR1) ? 0 : 1024)); #else else if (i==MIXSRC_SH) return (switchState(SW_SH0) ? -1024 : 1024); - else if (i==MIXSRC_SI) return (switchState(SW_SI0) ? -1024 : 1024); - else if (i==MIXSRC_SJ) return (switchState(SW_SJ0) ? -1024 : 1024); - else if (i==MIXSRC_SK) return (switchState(SW_SK0) ? -1024 : 1024); - else if (i==MIXSRC_SL) return (switchState(SW_SL0) ? -1024 : 1024); - else if (i==MIXSRC_SM) return (switchState(SW_SM0) ? -1024 : 1024); - else if (i==MIXSRC_SN) return (switchState(SW_SN0) ? -1024 : 1024); #endif #else else if (i==MIXSRC_3POS) return (getSwitch(SW_ID0-SW_BASE+1) ? -1024 : (getSwitch(SW_ID1-SW_BASE+1) ? 0 : 1024)); diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index b6d709e79..07c4256c4 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -354,7 +354,7 @@ enum uartModes { #define EXTRA_GENERAL_FIELDS \ EXTRA_GENERAL_FIELDS_ARM \ uint8_t uart3Mode; \ - uint8_t potsType; /*two bits for every pot*/\ + uint8_t potsConfig; /*two bits for every pot*/\ uint8_t backlightColor; #elif defined(CPUARM) #define EXTRA_GENERAL_FIELDS EXTRA_GENERAL_FIELDS_ARM @@ -399,9 +399,14 @@ PACK(typedef struct { TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, TRAINER_MODE_MASTER_BATTERY_COMPARTMENT, }; + enum PotsWarnMode { + POTS_WARN_OFF, + POTS_WARN_MANUAL, + POTS_WARN_AUTO + }; #define IS_TRAINER_EXTERNAL_MODULE() (g_model.trainerMode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || g_model.trainerMode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE) #define MODELDATA_BITMAP char bitmap[LEN_BITMAP_NAME]; - #define MODELDATA_EXTRA uint8_t externalModule; uint8_t trainerMode; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t nPotsToWarn; int8_t potPosition[NUM_POTS]; + #define MODELDATA_EXTRA uint8_t externalModule:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS]; #if defined(REV9E) #define swarnstate_t uint64_t #else @@ -665,16 +670,58 @@ PACK(typedef struct { #define CFN_GVAR_CST_MAX 125 #endif -enum SwitchConfig { - SWITCH_NONE = -1, - SWITCH_DEFAULT, - SWITCH_TOGGLE, - SWITCH_2POS, - SWITCH_3POS, -#if !defined(REV9E) - SWITCH_2x2POS +#if defined(PCBTARANIS) + int switchConfig(int idx); + #define IS_3POS(x) (switchConfig(x) == SWITCH_3POS) + #define IS_TOGGLE(x) (switchConfig(x) == SWITCH_TOGGLE) +#endif + +#if defined(PCBTARANIS) && defined(REV9E) + PACK(union SwitchConfig3bits { + SwitchConfig3bits(uint8_t val): + word(val) + { + } + struct { + int8_t val:3; + int8_t spare:5; + }; + uint8_t word; + }); + enum SwitchConfig { + SWITCH_NONE = -1, + SWITCH_DEFAULT, + SWITCH_TOGGLE, + SWITCH_2POS, + SWITCH_3POS, + }; + #define GENERAL_FIELD_SWITCH_CONFIG uint64_t switchConfig; + #define SWITCH_CONFIG(x) SwitchConfig3bits((g_eeGeneral.switchConfig >> (3*(x))) & 0x07).val + #define SWITCH_DEFAULT_CONFIG(x) (SWITCH_3POS) + #define SWITCH_EXISTS(x) (switchConfig(x) != SWITCH_NONE) + #define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !IS_TOGGLE(x)) +#elif defined(PCBTARANIS) + enum SwitchConfig { + SWITCH_DEFAULT, + SWITCH_TOGGLE, + SWITCH_2POS, + SWITCH_3POS, + }; + enum PotConfig { + POT_NONE, + POT_WITH_DETENT, + POT_MULTIPOS_SWITCH, + POT_WITHOUT_DETENT + }; + #define GENERAL_FIELD_SWITCH_CONFIG uint16_t switchConfig; + #define SWITCH_CONFIG(x) ((g_eeGeneral.switchConfig >> (2*(x))) & 0x03) + #define SWITCH_DEFAULT_CONFIG(x) ((x)==5 ? SWITCH_2POS : ((x)==7 ? SWITCH_TOGGLE : SWITCH_3POS)) + #define SWITCH_EXISTS(x) (true) + #define SWITCH_WARNING_ALLOWED(x) (!IS_TOGGLE(x)) + #define POT_CONFIG(x) ((g_eeGeneral.potsConfig >> (2*(x))) & 0x03) +#else + #define GENERAL_FIELD_SWITCH_CONFIG #endif -}; #define LEN_SWITCH_NAME 3 #define LEN_ANA_NAME 3 @@ -729,7 +776,7 @@ PACK(typedef struct { ARM_FIELD(CustomFunctionData customFn[NUM_CFN]) - TARANIS_FIELD(uint32_t switchConfig) + GENERAL_FIELD_SWITCH_CONFIG TARANIS_FIELD(char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]) @@ -742,34 +789,6 @@ PACK(typedef struct { #define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength) #if defined(PCBTARANIS) -PACK(union SwitchConfig4bits { - SwitchConfig4bits(uint8_t val): - word(val) - { - } - struct { - int8_t val:4; - int8_t spare:4; - }; - uint8_t word; -}); -#define SWITCH_CONFIG(x) SwitchConfig4bits((g_eeGeneral.switchConfig >> (4*(x))) & 0x0f).val -int switchConfig(int idx); -#define IS_3POS(x) (switchConfig(x) == SWITCH_3POS) -#define IS_TOGGLE(x) (switchConfig(x) == SWITCH_TOGGLE) -#if defined(REV9E) - #define SWITCH_DEFAULT_CONFIG(x) (SWITCH_3POS) - #define IS_2x2POS(x) (false) - #define ONE_2x2POS_DEFINED() (false) - #define SWITCH_EXISTS(x) (switchConfig(x) != SWITCH_NONE) - #define SWITCH_WARNING_ALLOWED(x) (!IS_TOGGLE(x)) -#else - #define SWITCH_DEFAULT_CONFIG(x) ((x)==5 ? SWITCH_2POS : ((x)==7 ? SWITCH_TOGGLE : SWITCH_3POS)) - #define IS_2x2POS(x) (switchConfig(x) == SWITCH_2x2POS) - #define ONE_2x2POS_DEFINED() (g_eeGeneral.switchConfig & 0x44444444) - #define SWITCH_EXISTS(x) ((x)<8 ? (switchConfig(x) != SWITCH_NONE) : (IS_2x2POS(x-8))) - #define SWITCH_WARNING_ALLOWED(x) ((x)<8 ? !IS_TOGGLE(x) : IS_2x2POS(x-8)) -#endif inline int getSwitchWarningsAllowed() { int count = 0; @@ -1684,19 +1703,7 @@ enum SwitchSources { SWSRC_SR2, SWSRC_LAST_SWITCH = SWSRC_SR2, #else - SWSRC_SI0, - SWSRC_SI2, - SWSRC_SJ0, - SWSRC_SJ2, - SWSRC_SK0, - SWSRC_SK2, - SWSRC_SL0, - SWSRC_SL2, - SWSRC_SM0, - SWSRC_SM2, - SWSRC_SN0, - SWSRC_SN2, - SWSRC_LAST_SWITCH = SWSRC_SN2, + SWSRC_LAST_SWITCH = SWSRC_SH2, #endif #else SWSRC_ID0 = SWSRC_FIRST_SWITCH, @@ -1853,14 +1860,13 @@ enum MixSources { MIXSRC_SF, LUA_EXPORT("sf", "Switch F") MIXSRC_SG, LUA_EXPORT("sg", "Switch G") MIXSRC_SH, LUA_EXPORT("sh", "Switch H") - +#if defined(REV9E) MIXSRC_SI, LUA_EXPORT("si", "Switch I") MIXSRC_SJ, LUA_EXPORT("sj", "Switch J") MIXSRC_SK, LUA_EXPORT("sk", "Switch K") MIXSRC_SL, LUA_EXPORT("sl", "Switch L") MIXSRC_SM, LUA_EXPORT("sm", "Switch M") MIXSRC_SN, LUA_EXPORT("sn", "Switch N") -#if defined(REV9E) MIXSRC_SO, LUA_EXPORT("so", "Switch O") MIXSRC_SP, LUA_EXPORT("sp", "Switch P") MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q") @@ -2117,7 +2123,7 @@ PACK(typedef struct { uint8_t extendedTrims:1; uint8_t throttleReversed:1; AVR_FIELD(int8_t ppmDelay) - BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7 + BeepANACenter beepANACenter; MixData mixData[MAX_MIXERS]; LimitData limitData[NUM_CHNOUT]; ExpoData expoData[MAX_EXPOS]; diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 628433752..e24d79a1b 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1887,10 +1887,12 @@ void opentxClose() #endif #if defined(PCBTARANIS) - if ((g_model.nPotsToWarn >> 6) == 2) { - for (uint8_t i=0; i=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS) - #define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT) + #define IS_POT_AVAILABLE(x) ((x)POT_LAST || ((g_eeGeneral.potsConfig & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE)) + #define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsConfig>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS) + #define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsConfig>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT) #elif defined(PCBTARANIS) && defined(REVPLUS) - #define IS_POT_AVAILABLE(x) ((x)!=POT3 || (g_eeGeneral.potsType & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE) - #define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS) - #define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT) + #define IS_POT_AVAILABLE(x) ((x)!=POT3 || (g_eeGeneral.potsConfig & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE) + #define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsConfig>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS) + #define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsConfig>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT) #elif defined(PCBTARANIS) #define IS_POT_AVAILABLE(x) ((x)!=POT3) - #define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS) - #define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT) + #define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsConfig>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS) + #define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsConfig>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT) #else #define IS_POT_AVAILABLE(x) (true) #define IS_POT_MULTIPOS(x) (false) @@ -382,7 +382,7 @@ enum PotType { #define IS_POT(x) ((x)>=POT1 && (x)<=POT_LAST) #define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4) -#define SAVE_POT_POSITION(i) g_model.potPosition[i] = GET_LOWRES_POT_POSITION(i) +#define SAVE_POT_POSITION(i) g_model.potsWarnPosition[i] = GET_LOWRES_POT_POSITION(i) #if ROTARY_ENCODERS > 0 #define IF_ROTARY_ENCODERS(x) x, diff --git a/radio/src/simu.cpp b/radio/src/simu.cpp index 52bd7246a..ef26ebd3f 100644 --- a/radio/src/simu.cpp +++ b/radio/src/simu.cpp @@ -215,7 +215,7 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*) KEY_Page_Down, KEY_PAGE, KEY_Return, KEY_ENTER, KEY_BackSpace, KEY_EXIT, - KEY_Up, KEY_PLUS, + KEY_Up, KEY_PLUS, KEY_Down, KEY_MINUS, #else KEY_Return, KEY_MENU, @@ -298,16 +298,16 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*) SWITCH_KEY(F, 5, 3); SWITCH_KEY(G, 6, 3); SWITCH_KEY(H, 7, 3); - // SWITCH_KEY(I, 8, 3); - // SWITCH_KEY(J, 9, 3); - // SWITCH_KEY(K, 10, 3); - // SWITCH_KEY(L, 11, 3); - // SWITCH_KEY(M, 12, 3); - // SWITCH_KEY(N, 13, 3); - // SWITCH_KEY(O, 14, 3); - // SWITCH_KEY(P, 15, 3); - // SWITCH_KEY(Q, 16, 3); - // SWITCH_KEY(R, 17, 3); + SWITCH_KEY(I, 8, 3); + SWITCH_KEY(J, 9, 3); + SWITCH_KEY(K, 10, 3); + SWITCH_KEY(L, 11, 3); + SWITCH_KEY(M, 12, 3); + SWITCH_KEY(N, 13, 3); + SWITCH_KEY(O, 14, 3); + SWITCH_KEY(P, 15, 3); + SWITCH_KEY(Q, 16, 3); + SWITCH_KEY(R, 17, 3); #elif defined(PCBTARANIS) SWITCH_KEY(A, 0, 3); SWITCH_KEY(B, 1, 3); diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index 7981f7f7c..9daefb0a5 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -180,18 +180,6 @@ void getSwitchesPosition(bool startup) CHECK_2POS(SW_SF); CHECK_3POS(5, SW_SG); CHECK_2POS(SW_SH); - if (IS_2x2POS(0)) - CHECK_2POS(SW_SI); - if (IS_2x2POS(1)) - CHECK_2POS(SW_SJ); - if (IS_2x2POS(2)) - CHECK_2POS(SW_SK); - if (IS_2x2POS(3)) - CHECK_2POS(SW_SL); - if (IS_2x2POS(4)) - CHECK_2POS(SW_SM); - if (IS_2x2POS(6)) - CHECK_2POS(SW_SN); switchesPos = newPos; @@ -670,24 +658,21 @@ void checkSwitches() } } } - uint8_t potMode = g_model.nPotsToWarn >> 6; - if (potMode) { + if (g_model.potsWarnMode) { evalFlightModeMixes(e_perout_mode_normal, 0); bad_pots = 0; - for (uint8_t i=0; i 1)) { + if (!(g_model.potsWarnEnabled & (1 << i)) && (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1)) { warn = true; bad_pots |= (1< 1) { + if (!(g_model.potsWarnEnabled & (1 << i))) { + if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) { + TRACE("POS %d vs %d", g_model.potsWarnPosition[i], GET_LOWRES_POT_POSITION(i)); lcd_putsiAtt(x, y, STR_VSRCRAW, NUM_STICKS+1+i, INVERS); switch (i) { case 0: case 1: case 2: - lcd_putcAtt(lcdNextPos, y, g_model.potPosition[i] > GET_LOWRES_POT_POSITION(i) ? 126 : 127, INVERS); + lcd_putcAtt(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? 126 : 127, INVERS); break; case 3: case 4: - lcd_putcAtt(lcdNextPos, y, g_model.potPosition[i] > GET_LOWRES_POT_POSITION(i) ? '\300' : '\301', INVERS); + lcd_putcAtt(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? '\300' : '\301', INVERS); break; } x = lcdNextPos + 3; diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 3d8f468a9..0d04bbab6 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -191,20 +191,20 @@ void simuSetSwitch(uint8_t swtch, int8_t state) SWITCH_3_CASE(1, GPIO_PIN_SW_B_L, GPIO_PIN_SW_B_H, PIN_SW_B_L, PIN_SW_B_H) SWITCH_3_CASE(2, GPIO_PIN_SW_C_L, GPIO_PIN_SW_C_H, PIN_SW_C_L, PIN_SW_C_H) SWITCH_3_CASE(3, GPIO_PIN_SW_D_L, GPIO_PIN_SW_D_H, PIN_SW_D_L, PIN_SW_D_H) - SWITCH_3_CASE(4, GPIO_PIN_SW_E_H, GPIO_PIN_SW_E_L, PIN_SW_E_H, PIN_SW_E_L) - SWITCH_3_CASE(5, GPIO_PIN_SW_F_H, GPIO_PIN_SW_F_L, PIN_SW_F_H, PIN_SW_F_L) + SWITCH_3_CASE(4, GPIO_PIN_SW_E_L, GPIO_PIN_SW_E_H, PIN_SW_E_L, PIN_SW_E_H) + SWITCH_3_CASE(5, GPIO_PIN_SW_F_L, GPIO_PIN_SW_F_H, PIN_SW_F_L, PIN_SW_F_H) SWITCH_3_CASE(6, GPIO_PIN_SW_G_L, GPIO_PIN_SW_G_H, PIN_SW_G_L, PIN_SW_G_H) - SWITCH_3_CASE(7, GPIO_PIN_SW_H_L, GPIO_PIN_SW_H_H, PIN_SW_H_H, PIN_SW_H_L) - SWITCH_3_CASE(8, GPIO_PIN_SW_I_L, GPIO_PIN_SW_I_H, PIN_SW_I_H, PIN_SW_I_L) - SWITCH_3_CASE(9, GPIO_PIN_SW_J_L, GPIO_PIN_SW_J_H, PIN_SW_J_H, PIN_SW_J_L) - SWITCH_3_CASE(10, GPIO_PIN_SW_K_L, GPIO_PIN_SW_K_H, PIN_SW_K_H, PIN_SW_I_L) - SWITCH_3_CASE(11, GPIO_PIN_SW_L_L, GPIO_PIN_SW_L_H, PIN_SW_L_H, PIN_SW_J_L) - SWITCH_3_CASE(12, GPIO_PIN_SW_M_L, GPIO_PIN_SW_M_H, PIN_SW_M_H, PIN_SW_I_L) - SWITCH_3_CASE(13, GPIO_PIN_SW_N_L, GPIO_PIN_SW_N_H, PIN_SW_N_H, PIN_SW_J_L) - SWITCH_3_CASE(14, GPIO_PIN_SW_O_L, GPIO_PIN_SW_O_H, PIN_SW_O_H, PIN_SW_I_L) - SWITCH_3_CASE(15, GPIO_PIN_SW_P_L, GPIO_PIN_SW_P_H, PIN_SW_P_H, PIN_SW_J_L) - SWITCH_3_CASE(16, GPIO_PIN_SW_Q_L, GPIO_PIN_SW_Q_H, PIN_SW_Q_H, PIN_SW_I_L) - SWITCH_3_CASE(17, GPIO_PIN_SW_R_L, GPIO_PIN_SW_R_H, PIN_SW_R_H, PIN_SW_J_L) + SWITCH_3_CASE(7, GPIO_PIN_SW_H_L, GPIO_PIN_SW_H_H, PIN_SW_H_L, PIN_SW_H_H) + SWITCH_3_CASE(8, GPIO_PIN_SW_I_L, GPIO_PIN_SW_I_H, PIN_SW_I_L, PIN_SW_I_H) + SWITCH_3_CASE(9, GPIO_PIN_SW_J_L, GPIO_PIN_SW_J_H, PIN_SW_J_L, PIN_SW_J_H) + SWITCH_3_CASE(10, GPIO_PIN_SW_K_L, GPIO_PIN_SW_K_H, PIN_SW_K_L, PIN_SW_K_H) + SWITCH_3_CASE(11, GPIO_PIN_SW_L_L, GPIO_PIN_SW_L_H, PIN_SW_L_L, PIN_SW_L_H) + SWITCH_3_CASE(12, GPIO_PIN_SW_M_L, GPIO_PIN_SW_M_H, PIN_SW_M_L, PIN_SW_M_H) + SWITCH_3_CASE(13, GPIO_PIN_SW_N_L, GPIO_PIN_SW_N_H, PIN_SW_N_L, PIN_SW_N_H) + SWITCH_3_CASE(14, GPIO_PIN_SW_O_L, GPIO_PIN_SW_O_H, PIN_SW_O_L, PIN_SW_O_H) + SWITCH_3_CASE(15, GPIO_PIN_SW_P_L, GPIO_PIN_SW_P_H, PIN_SW_P_L, PIN_SW_P_H) + SWITCH_3_CASE(16, GPIO_PIN_SW_Q_L, GPIO_PIN_SW_Q_H, PIN_SW_Q_L, PIN_SW_Q_H) + SWITCH_3_CASE(17, GPIO_PIN_SW_R_L, GPIO_PIN_SW_R_H, PIN_SW_R_L, PIN_SW_R_H) #elif defined(PCBTARANIS) SWITCH_3_CASE(0, GPIO_PIN_SW_A_L, GPIO_PIN_SW_A_H, PIN_SW_A_L, PIN_SW_A_H) SWITCH_3_CASE(1, GPIO_PIN_SW_B_L, GPIO_PIN_SW_B_H, PIN_SW_B_L, PIN_SW_B_H) @@ -895,8 +895,9 @@ FRESULT f_unlink (const TCHAR*) return FR_OK; } -FRESULT f_rename(const TCHAR*, const TCHAR*) +FRESULT f_rename(const TCHAR *oldname, const TCHAR *newname) { + TRACE("f_rename(%s, %s)", oldname, newname); return FR_OK; } diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 76852b30e..d873608de 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -57,7 +57,11 @@ const pm_char STR_OPEN9X[] PROGMEM = ISTR(TRNCHN) #if defined(PCBTARANIS) ISTR(UART3MODES) + ISTR(SWTYPES) ISTR(POTTYPES) +#endif +#if defined(CPUARM) + ISTR(VDISPLAYTRIMS) #endif ISTR(VTRIMINC) ISTR(RETA123) @@ -141,9 +145,11 @@ const pm_char STR_TIMER[] PROGMEM = TR_TIMER; const pm_char STR_ELIMITS[] PROGMEM = TR_ELIMITS; const pm_char STR_ETRIMS[] PROGMEM = TR_ETRIMS; const pm_char STR_TRIMINC[] PROGMEM = TR_TRIMINC; +const pm_char STR_DISPLAY_TRIMS[] PROGMEM = TR_DISPLAY_TRIMS; const pm_char STR_TTRACE[] PROGMEM = TR_TTRACE; const pm_char STR_TTRIM[] PROGMEM = TR_TTRIM; const pm_char STR_BEEPCTR[] PROGMEM = TR_BEEPCTR; +const pm_char STR_USE_GLOBAL_FUNCS[] PROGMEM = TR_USE_GLOBAL_FUNCS; const pm_char STR_PROTO[] PROGMEM = TR_PROTO; const pm_char STR_PPMFRAME[] PROGMEM = TR_PPMFRAME; const pm_char STR_MS[] PROGMEM = TR_MS; @@ -248,6 +254,9 @@ const pm_char STR_PITCH_AT_MAX[] PROGMEM = TR_PITCH_AT_MAX; const pm_char STR_REPEAT_AT_ZERO[] PROGMEM = TR_REPEAT_AT_ZERO; #endif const pm_char STR_RXCHANNELORD[] PROGMEM = TR_RXCHANNELORD; +const pm_char STR_STICKS[] PROGMEM = TR_STICKS; +const pm_char STR_POTS[] PROGMEM = TR_POTS; +const pm_char STR_SWITCHES[] PROGMEM = TR_SWITCHES; const pm_char STR_SWITCHES_DELAY[] PROGMEM = TR_SWITCHES_DELAY; const pm_char STR_SLAVE[] PROGMEM = TR_SLAVE; const pm_char STR_MODESRC[] PROGMEM = TR_MODESRC; diff --git a/radio/src/translations.h b/radio/src/translations.h index d0ac62278..bce3e0d89 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -104,12 +104,18 @@ extern const pm_char STR_OPEN9X[]; #define OFS_TRNCHN (OFS_TRNMODE + sizeof(TR_TRNMODE)) #if defined(PCBTARANIS) #define OFS_UART3MODES (OFS_TRNCHN + sizeof(TR_TRNCHN)) - #define OFS_POTTYPES (OFS_UART3MODES + sizeof(TR_UART3MODES)) + #define OFS_SWTYPES (OFS_UART3MODES + sizeof(TR_UART3MODES)) + #define OFS_POTTYPES (OFS_SWTYPES + sizeof(TR_SWTYPES)) #define OFS_VTRIMINC (OFS_POTTYPES + sizeof(TR_POTTYPES)) #else #define OFS_VTRIMINC (OFS_TRNCHN + sizeof(TR_TRNCHN)) #endif -#define OFS_RETA123 (OFS_VTRIMINC + sizeof(TR_VTRIMINC)) +#if defined(CPUARM) + #define OFS_VDISPLAYTRIMS (OFS_VTRIMINC + sizeof(TR_VTRIMINC)) + #define OFS_RETA123 (OFS_VDISPLAYTRIMS + sizeof(TR_VDISPLAYTRIMS)) +#else + #define OFS_RETA123 (OFS_VTRIMINC + sizeof(TR_VTRIMINC)) +#endif #define OFS_VPROTOS (OFS_RETA123 + sizeof(TR_RETA123)) #define OFS_POSNEG (OFS_VPROTOS + sizeof(TR_VPROTOS)) #define OFS_VBLMODE (OFS_POSNEG + sizeof(TR_POSNEG)) @@ -207,8 +213,10 @@ extern const pm_char STR_OPEN9X[]; #define STR_TRNMODE (STR_OPEN9X + OFS_TRNMODE) #define STR_TRNCHN (STR_OPEN9X + OFS_TRNCHN) #define STR_UART3MODES (STR_OPEN9X + OFS_UART3MODES) +#define STR_SWTYPES (STR_OPEN9X + OFS_SWTYPES) #define STR_POTTYPES (STR_OPEN9X + OFS_POTTYPES) #define STR_VTRIMINC (STR_OPEN9X + OFS_VTRIMINC) +#define STR_VDISPLAYTRIMS (STR_OPEN9X + OFS_VDISPLAYTRIMS) #define STR_RETA123 (STR_OPEN9X + OFS_RETA123) #define STR_VPROTOS (STR_OPEN9X + OFS_VPROTOS) #define STR_POSNEG (STR_OPEN9X + OFS_POSNEG) @@ -320,9 +328,11 @@ extern const pm_char STR_TIMER[]; extern const pm_char STR_ELIMITS[]; extern const pm_char STR_ETRIMS[]; extern const pm_char STR_TRIMINC[]; +extern const pm_char STR_DISPLAY_TRIMS[]; extern const pm_char STR_TTRACE[]; extern const pm_char STR_TTRIM[]; extern const pm_char STR_BEEPCTR[]; +extern const pm_char STR_USE_GLOBAL_FUNCS[]; extern const pm_char STR_PROTO[]; extern const pm_char STR_PPMFRAME[]; extern const pm_char STR_MS[]; @@ -421,6 +431,9 @@ extern const pm_char STR_PITCH_AT_ZERO[]; extern const pm_char STR_PITCH_AT_MAX[]; extern const pm_char STR_REPEAT_AT_ZERO[]; extern const pm_char STR_RXCHANNELORD[]; +extern const pm_char STR_STICKS[]; +extern const pm_char STR_POTS[]; +extern const pm_char STR_SWITCHES[]; extern const pm_char STR_SWITCHES_DELAY[]; extern const pm_char STR_SLAVE[]; extern const pm_char STR_MODESRC[]; diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 3cd8347a2..3a93a3fa9 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -82,6 +82,13 @@ #define LEN_UART3MODES "\015" #define TR_UART3MODES "OFF\0 ""S-Port Mirror""Telemetry\0 ""SBUS Trainer\0""Debug\0" +#define LEN_SWTYPES "\007" +#if defined(REV9E) + #define TR_SWTYPES "None\0 ""Default""Toggle\0""2POS\0 ""3POS\0" +#else + #define TR_SWTYPES "Default""Toggle\0""2POS\0 ""3POS\0" +#endif + #define LEN_POTTYPES "\017" #define TR_POTTYPES "None\0 ""Pot with detent""Multipos Switch""Pot\0" @@ -109,6 +116,9 @@ #define LEN_VTRIMINC TR("\006", "\013") #define TR_VTRIMINC TR("Expo\0 ""ExFine""Fine\0 ""Medium""Coarse", "Exponential""Extra Fine\0""Fine\0 ""Medium\0 ""Coarse\0 ") +#define LEN_VDISPLAYTRIMS "\006" +#define TR_VDISPLAYTRIMS "No\0 ""Change""Yes\0" + #define LEN_VBEEPCOUNTDOWN "\006" #define TR_VBEEPCOUNTDOWN "SilentBeeps\0Voice\0" @@ -117,7 +127,9 @@ #define LEN_RETA123 "\001" -#if defined(PCBTARANIS) || defined(REVX) +#if defined(PCBTARANIS) && defined(REV9E) + #define TR_RETA123 "RETA1234LRLR" +#elif defined(PCBTARANIS) || defined(REVX) #define TR_RETA123 "RETA123LR" #elif defined(PCBSKY9X) #define TR_RETA123 "RETA123a" @@ -467,7 +479,7 @@ #if defined(PCBTARANIS) && defined(REV9E) #define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF-""SF\301""SG\300""SG-""SG\301""SH\300""SH-""SH\301""SI\300""SI-""SI\301""SJ\300""SJ-""SJ\301""SK\300""SK-""SK\301""SL\300""SL-""SL\301""SM\300""SM-""SM\301""SN\300""SN-""SN\301""SO\300""SO-""SO\301""SP\300""SP-""SP\301""SQ\300""SQ-""SQ\301""SR\300""SR-""SR\301" #elif defined(PCBTARANIS) - #define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301""SI\300""SI\301""SJ\300""SJ\301""SK\300""SK\301""SL\300""SL\301""SM\300""SM\301""SN\300""SN\301" + #define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" #else #define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" #endif @@ -565,9 +577,11 @@ #define TR_ELIMITS TR("E.Limits", "Extended Limits") #define TR_ETRIMS TR("E.Trims", "Extended Trims") #define TR_TRIMINC "Trim Step" +#define TR_DISPLAY_TRIMS "Display Trims" #define TR_TTRACE TR("T-Source", INDENT "Source") #define TR_TTRIM TR("T-Trim", INDENT "Trim Idle Only") #define TR_BEEPCTR TR("Ctr Beep", "Center Beep") +#define TR_USE_GLOBAL_FUNCS "Use Global Funcs" #define TR_PROTO TR(INDENT "Proto", INDENT "Protocol") #if defined(CPUARM) #define TR_PPMFRAME INDENT "PPM frame" @@ -597,7 +611,7 @@ #define TR_EDITMIX "EDIT MIX " #define TR_SOURCE INDENT "Source" #define TR_WEIGHT "Weight" -#define TR_EXPO TR("Expo","Exponential") +#define TR_EXPO TR("Expo", "Exponential") #define TR_SIDE "Side" #define TR_DIFFERENTIAL "Differ" #define TR_OFFSET INDENT "Offset" @@ -605,7 +619,7 @@ #define TR_DREX "DRex" #define DREX_CHBOX_OFFSET 30 #define TR_CURVE "Curve" -#define TR_FLMODE TR("Mode","Modes") +#define TR_FLMODE TR("Mode", "Modes") #define TR_MIXWARNING "Warning" #define TR_OFF "OFF" #define TR_MULTPX "Multpx" @@ -640,9 +654,9 @@ #define TR_THROTTLE_LABEL "Throttle" #define TR_THROTTLEREVERSE TR("T-Reverse", INDENT "Reverse") #define TR_TIMER_NAME INDENT "Name" -#define TR_MINUTEBEEP TR(INDENT "Minute",INDENT "Minute call") +#define TR_MINUTEBEEP TR(INDENT "Minute", INDENT "Minute call") #define TR_BEEPCOUNTDOWN INDENT "Countdown" -#define TR_PERSISTENT TR(INDENT "Persist.",INDENT "Persistent") +#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistent") #define TR_BACKLIGHT_LABEL "Backlight" #define TR_BLDELAY INDENT "Duration" #define TR_BLONBRIGHTNESS INDENT "ON Brightness" @@ -654,7 +668,10 @@ #define TR_POTWARNING TR(IF_CPUARM(INDENT) "Pot Warn.", INDENT "Pot Positions") #define TR_TIMEZONE TR("Time Zone", "GPS Time zone") #define TR_RXCHANNELORD TR("Rx Channel Ord", "Default channel order") -#define TR_SWITCHES_DELAY TR("Play delay","Play Delay (sw. mid pos)") +#define TR_STICKS "Sticks" +#define TR_POTS "Pots" +#define TR_SWITCHES "Switches" +#define TR_SWITCHES_DELAY TR("Play delay", "Play Delay (sw. mid pos)") #define TR_SLAVE CENTER "Slave" #define TR_MODESRC "Mode\006% Source" #define TR_MULTIPLIER "Multiplier" @@ -709,8 +726,8 @@ #define TR_MENUTRAINER "TRAINER" #define TR_MENUGLOBALFUNCS "GLOBAL FUNCTIONS" #define TR_MENUVERSION "VERSION" -#define TR_MENUDIAG TR("SWITCHES","SWITCH TEST") -#define TR_MENUANA TR("ANAS","ANALOG INPUTS") +#define TR_MENUDIAG TR("SWITCHES", "SWITCH TEST") +#define TR_MENUANA TR("ANAS", "ANALOG INPUTS") #define TR_MENUCALIBRATION "CALIBRATION" #if defined(COLORLCD) #define TR_TRIMS2OFFSETS "Trims >> Subtrims" @@ -723,9 +740,9 @@ #define TR_MENUFLIGHTPHASE "FLIGHT MODE" #define TR_MENUHELISETUP "HELI SETUP" -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) #define TR_MENUINPUTS "INPUTS" - #define TR_MENULIMITS "SERVOS" + #define TR_MENULIMITS "OUTPUTS" #else #define TR_MENUINPUTS "STICKS" #define TR_MENULIMITS "SERVOS"