diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index 21704e723..98894d298 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -178,7 +178,9 @@ const SwitchInfo Boards::getSwitchInfo(Board::Type board, int index) {SWITCH_3POS, "SC"}, {SWITCH_3POS, "SD"}, {SWITCH_2POS, "SF"}, - {SWITCH_TOGGLE, "SH"} + {SWITCH_TOGGLE, "SH"}, + {SWITCH_2POS, "SI"}, + {SWITCH_2POS, "SJ"} }; if (index < DIM(switches)) return switches[index]; @@ -281,7 +283,7 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability) else if (IS_TARANIS_X9LITE(board)) return 5; else if (IS_TARANIS_X7(board)) - return 6; + return 8; else if (IS_TARANIS_XLITES(board)) return 6; else if (IS_TARANIS_XLITE(board)) diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 701fe9b1c..f88b2326d 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -31,7 +31,7 @@ using namespace Board; #define MAX_SLIDERS(board) (IS_HORUS_X10(board) ? 4 : (Boards::getCapability(board, Board::Sliders))) //TODO need to be remove when x10 eeprom gets fixed #define MAX_MOUSE_ANALOGS(board) (IS_HORUS_X10(board) ? 2 : (Boards::getCapability(board, Board::MouseAnalogs))) //TODO need to be remove when x10 eeprom gets fixed #define MAX_GYRO_ANALOGS(board, version) (version >= 219 ? Boards::getCapability(board, Board::GyroAnalogs) : 0) -#define MAX_SWITCHES(board, version) (Boards::getCapability(board, Board::Switches)) +#define MAX_SWITCHES(board, version) (version <= 218 && IS_TARANIS_X7(board) ? 6 : Boards::getCapability(board, Board::Switches)) #define MAX_SWITCH_SLOTS(board, version) (IS_TARANIS_X9E(board) ? 32 : 8) // bitsize of swconfig_t / 2 (see radio/src/datastructs.h) #define MAX_SWITCHES_POSITION(board, version) (Boards::getCapability(board, Board::SwitchPositions)) #define MAX_ROTARY_ENCODERS(board) (IS_SKY9X(board) ? 1 : 0) diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index 8b76fbeac..50fad5766 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -403,6 +403,14 @@ enum SwitchSources { SWSRC_SH1, SWSRC_SH2, #endif +#if defined(PCBX7) + SWSRC_SI0, + SWSRC_SI1, + SWSRC_SI2, + SWSRC_SJ0, + SWSRC_SJ1, + SWSRC_SJ2, +#endif #if defined(PCBX9E) SWSRC_SI0, SWSRC_SI1, @@ -436,11 +444,6 @@ enum SwitchSources { SWSRC_SR2, #endif SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + NUM_SWITCHES_POSITIONS - 1, -#if NUM_SWITCHES >= 8 - SWSRC_TRAINER = SWSRC_SH2, -#else - SWSRC_TRAINER = SWSRC_LAST_SWITCH, -#endif #else // neither Taranis nor Horus SWSRC_ID0 = SWSRC_FIRST_SWITCH, SWSRC_ID1, @@ -523,6 +526,12 @@ enum SwitchSources { SWSRC_INVERT = SWSRC_COUNT+1, }; +#if NUM_SWITCHES >= 8 + #define SWSRC_TRAINER SWSRC_SH2 +#else + #define SWSRC_TRAINER SWSRC_LAST_SWITCH, +#endif + #define SWSRC_LAST_TRIM (SWSRC_FIRST_TRIM + 2*NUM_TRIMS - 1) enum MixSources { @@ -635,6 +644,10 @@ enum MixSources { #if defined(PCBHORUS) || defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX9E) || defined(PCBX7) MIXSRC_SH, LUA_EXPORT("sh", "Switch H") #endif +#if defined(PCBX7) + MIXSRC_SI, LUA_EXPORT("si", "Switch I") + MIXSRC_SJ, LUA_EXPORT("sj", "Switch J") +#endif #if defined(PCBX9E) MIXSRC_SI, LUA_EXPORT("si", "Switch I") MIXSRC_SJ, LUA_EXPORT("sj", "Switch J") @@ -708,7 +721,9 @@ enum MixSources { MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1 }; +#if defined(__cplusplus) static_assert(MIXSRC_FIRST_LOGICAL_SWITCH == MIXSRC_FIRST_SWITCH + NUM_SWITCHES, "Wrong switches definition in MIXSRC list"); +#endif #define MIXSRC_FIRST (MIXSRC_NONE + 1) #define MIXSRC_LAST MIXSRC_LAST_CH diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 1457505c0..d4764817e 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -914,7 +914,7 @@ static inline void check_struct() CHKSIZE(RadioData, 852); CHKSIZE(ModelData, 6157); #elif defined(PCBX7) - CHKSIZE(RadioData, 858); + CHKSIZE(RadioData, 864); CHKSIZE(ModelData, 6157); #elif defined(PCBX9E) CHKSIZE(RadioData, 960); diff --git a/radio/src/gui/128x64/radio_hardware.cpp b/radio/src/gui/128x64/radio_hardware.cpp index 1ff0626dd..1a768523d 100644 --- a/radio/src/gui/128x64/radio_hardware.cpp +++ b/radio/src/gui/128x64/radio_hardware.cpp @@ -109,6 +109,10 @@ enum MenuRadioHardwareItems { #endif #if NUM_SWITCHES >= 6 ITEM_RADIO_HARDWARE_SH, +#endif +#if NUM_SWITCHES >= 8 + ITEM_RADIO_HARDWARE_SI, + ITEM_RADIO_HARDWARE_SJ, #endif ITEM_RADIO_HARDWARE_BATTERY_CALIB, #if defined(STM32) @@ -142,7 +146,9 @@ enum MenuRadioHardwareItems { #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 #endif -#if NUM_SWITCHES == 6 +#if NUM_SWITCHES == 8 +#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 +#elif NUM_SWITCHES == 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 #elif NUM_SWITCHES == 5 #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 @@ -167,7 +173,7 @@ enum MenuRadioHardwareItems { #elif defined(PCBXLITE) #define SWITCH_TYPE_MAX(sw) (SWITCH_3POS) #else - #define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS) + #define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SI-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SJ-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS) #endif #if defined(STM32) @@ -291,6 +297,10 @@ void menuRadioHardware(event_t event) #endif #if NUM_SWITCHES >= 6 case ITEM_RADIO_HARDWARE_SH: +#endif +#if NUM_SWITCHES >= 8 + case ITEM_RADIO_HARDWARE_SI: + case ITEM_RADIO_HARDWARE_SJ: #endif { int index = k-ITEM_RADIO_HARDWARE_SA; diff --git a/radio/src/storage/conversions/conversions_216_218.cpp b/radio/src/storage/conversions/conversions_216_218.cpp index 0f7eee09e..9c803a6f6 100644 --- a/radio/src/storage/conversions/conversions_216_218.cpp +++ b/radio/src/storage/conversions/conversions_216_218.cpp @@ -667,10 +667,10 @@ int ConvertTelemetrySource_216_to_217(int source) } #if defined(PCBTARANIS) -int ConvertSwitch_216_to_217(int swtch) +int convertSwitch_216_to_217(int swtch) { if (swtch < 0) - return -ConvertSwitch_216_to_217(-swtch); + return -convertSwitch_216_to_217(-swtch); if (swtch > SWSRC_SF0) swtch += 1; @@ -681,18 +681,18 @@ int ConvertSwitch_216_to_217(int swtch) return swtch; } #else -int ConvertSwitch_216_to_217(int swtch) +int convertSwitch_216_to_217(int swtch) { return swtch; } #endif -int ConvertSwitch_217_to_218(int swtch) +int convertSwitch_217_to_218(int swtch) { // 32 additional logical switches if (swtch < 0) - return -ConvertSwitch_217_to_218(-swtch); + return -convertSwitch_217_to_218(-swtch); if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH+32) return swtch+32; @@ -700,7 +700,7 @@ int ConvertSwitch_217_to_218(int swtch) return swtch; } -int ConvertSource_216_to_217(int source) +int convertSource_216_to_217(int source) { #if defined(PCBX9E) // SI to SR switches added @@ -714,7 +714,7 @@ int ConvertSource_216_to_217(int source) return source; } -int ConvertSource_217_to_218(int source) +int convertSource_217_to_218(int source) { #if defined(PCBTARANIS) if (source >= MIXSRC_FIRST_LOGICAL_SWITCH + 32) @@ -724,7 +724,7 @@ int ConvertSource_217_to_218(int source) return source; } -int ConvertGVar_216_to_217(int value) +int convertGVar_216_to_217(int value) { if (value < -4096 + 9) value += 4096 - 1024; @@ -826,10 +826,10 @@ void ConvertSpecialFunctions_217_to_218(CustomFunctionData_v218 * cf218, CustomF for (int i=0; i= TMRMODE_COUNT) - timer.mode = TMRMODE_COUNT + ConvertSwitch_216_to_217(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1; + timer.mode = TMRMODE_COUNT + convertSwitch_216_to_217(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1; else - timer.mode = ConvertSwitch_216_to_217(oldModel.timers[i].mode); + timer.mode = convertSwitch_216_to_217(oldModel.timers[i].mode); timer.start = oldModel.timers[i].start; timer.countdownBeep = oldModel.timers[i].countdownBeep; timer.minuteBeep = oldModel.timers[i].minuteBeep; @@ -945,8 +945,8 @@ void convertModelData_216_to_217(ModelData &model) newModel.mixData[i].mltpx = oldModel.mixData[i].mltpx; newModel.mixData[i].carryTrim = oldModel.mixData[i].carryTrim; newModel.mixData[i].mixWarn = oldModel.mixData[i].mixWarn; - newModel.mixData[i].weight = ConvertGVar_216_to_217(oldModel.mixData[i].weight); - newModel.mixData[i].swtch = ConvertSwitch_216_to_217(oldModel.mixData[i].swtch); + newModel.mixData[i].weight = convertGVar_216_to_217(oldModel.mixData[i].weight); + newModel.mixData[i].swtch = convertSwitch_216_to_217(oldModel.mixData[i].swtch); #if defined(PCBTARANIS) newModel.mixData[i].curve = oldModel.mixData[i].curve; #else @@ -958,15 +958,15 @@ void convertModelData_216_to_217(ModelData &model) newModel.mixData[i].delayDown = oldModel.mixData[i].delayDown; newModel.mixData[i].speedUp = oldModel.mixData[i].speedUp; newModel.mixData[i].speedDown = oldModel.mixData[i].speedDown; - newModel.mixData[i].srcRaw = ConvertSource_216_to_217(oldModel.mixData[i].srcRaw); - newModel.mixData[i].offset = ConvertGVar_216_to_217(oldModel.mixData[i].offset); + newModel.mixData[i].srcRaw = convertSource_216_to_217(oldModel.mixData[i].srcRaw); + newModel.mixData[i].offset = convertGVar_216_to_217(oldModel.mixData[i].offset); memcpy(newModel.mixData[i].name, oldModel.mixData[i].name, sizeof(newModel.mixData[i].name)); } for (int i=0; i= TMRMODE_COUNT) - newModel.timers[i].mode = TMRMODE_COUNT + ConvertSwitch_217_to_218(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1; + newModel.timers[i].mode = TMRMODE_COUNT + convertSwitch_217_to_218(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1; else - newModel.timers[i].mode = ConvertSwitch_217_to_218(oldModel.timers[i].mode); + newModel.timers[i].mode = convertSwitch_217_to_218(oldModel.timers[i].mode); if (oldModel.timers[i].mode) TRACE("timer mode %d => %d", oldModel.timers[i].mode, newModel.timers[i].mode); newModel.timers[i].start = oldModel.timers[i].start; @@ -1121,7 +1121,7 @@ void convertModelData_217_to_218(ModelData &model) newModel.mixData[i].carryTrim = oldModel.mixData[i].carryTrim; newModel.mixData[i].mixWarn = oldModel.mixData[i].mixWarn; newModel.mixData[i].weight = oldModel.mixData[i].weight; - newModel.mixData[i].swtch = ConvertSwitch_217_to_218(oldModel.mixData[i].swtch); + newModel.mixData[i].swtch = convertSwitch_217_to_218(oldModel.mixData[i].swtch); #if defined(PCBTARANIS) newModel.mixData[i].curve = oldModel.mixData[i].curve; #else @@ -1133,7 +1133,7 @@ void convertModelData_217_to_218(ModelData &model) newModel.mixData[i].delayDown = oldModel.mixData[i].delayDown; newModel.mixData[i].speedUp = oldModel.mixData[i].speedUp; newModel.mixData[i].speedDown = oldModel.mixData[i].speedDown; - newModel.mixData[i].srcRaw = ConvertSource_217_to_218(oldModel.mixData[i].srcRaw); + newModel.mixData[i].srcRaw = convertSource_217_to_218(oldModel.mixData[i].srcRaw); newModel.mixData[i].offset = oldModel.mixData[i].offset; memcpy(newModel.mixData[i].name, oldModel.mixData[i].name, sizeof(newModel.mixData[i].name)); } @@ -1147,7 +1147,7 @@ void convertModelData_217_to_218(ModelData &model) } for (int i=0; i> (2*i)) & 0x03) == TELEMETRY_SCREEN_TYPE_VALUES) { for (int j = 0; j < 4; j++) { for (int k = 0; k < NUM_LINE_ITEMS; k++) { - newModel.frsky.screens[i].lines[j].sources[k] = ConvertSource_217_to_218(oldModel.frsky.screens[i].lines[j].sources[k]); + newModel.frsky.screens[i].lines[j].sources[k] = convertSource_217_to_218(oldModel.frsky.screens[i].lines[j].sources[k]); } } } else if (((oldModel.frsky.screensType >> (2*i)) & 0x03) == TELEMETRY_SCREEN_TYPE_GAUGES) { for (int j = 0; j < 4; j++) { - newModel.frsky.screens[i].bars[j].source = ConvertSource_217_to_218(oldModel.frsky.screens[i].bars[j].source); + newModel.frsky.screens[i].bars[j].source = convertSource_217_to_218(oldModel.frsky.screens[i].bars[j].source); } } } diff --git a/radio/src/storage/conversions/conversions_218_219.cpp b/radio/src/storage/conversions/conversions_218_219.cpp index 4c93ac43e..7ea253cff 100644 --- a/radio/src/storage/conversions/conversions_218_219.cpp +++ b/radio/src/storage/conversions/conversions_218_219.cpp @@ -32,6 +32,33 @@ typedef ModelData ModelData_v219; +int convertSource_218_to_219(int source) +{ + // on X7: 2 additional switches + +#if defined(PCBX7) + if (source >= MIXSRC_SI) + source += 2; +#endif + + return source; +} + +int convertSwitch_218_to_219(int swtch) +{ + // on X7: 2 additional switches + +#if defined(PCBX7) + if (swtch < 0) + return -convertSwitch_218_to_219(-swtch); + + if (swtch >= SWSRC_SI0) + return swtch + 2 * 3; +#endif + + return swtch; +} + void convertModelData_218_to_219(ModelData &model) { static_assert(sizeof(ModelData_v218) <= sizeof(ModelData), "ModelData size has been reduced"); @@ -48,6 +75,8 @@ void convertModelData_218_to_219(ModelData &model) for (uint8_t i=0; i> (2*i)) & 0x03; + if (screenType == TELEMETRY_SCREEN_TYPE_VALUES) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < NUM_LINE_ITEMS; k++) { + newModel.screens[i].lines[j].sources[k] = convertSource_218_to_219(newModel.screens[i].lines[j].sources[k]); + } + } + } + else if (screenType == TELEMETRY_SCREEN_TYPE_GAUGES) { + for (int j = 0; j < 4; j++) { + newModel.screens[i].bars[j].source = convertSource_218_to_219(newModel.screens[i].bars[j].source); + } + } + } +#endif } diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index eb488d043..527a437a6 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -269,8 +269,8 @@ char * getSwitchString(char * dest, swsrc_t idx) else { *s++ = 'S'; #if defined(PCBX7) - if (swinfo.quot == 5) - *s++ = 'H'; + if (swinfo.quot >= 5) + *s++ = 'H' + swinfo.quot - 5; else if (swinfo.quot == 4) *s++ = 'F'; else diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 055b07f7f..8eba192a9 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -274,6 +274,8 @@ void simuSetSwitch(uint8_t swtch, int8_t state) #if defined(PCBX7) SWITCH_CASE (4, SWITCHES_GPIO_REG_F, SWITCHES_GPIO_PIN_F) SWITCH_CASE (5, SWITCHES_GPIO_REG_H, SWITCHES_GPIO_PIN_H) + SWITCH_CASE (6, SWITCHES_GPIO_REG_I, SWITCHES_GPIO_PIN_I) + SWITCH_CASE (7, SWITCHES_GPIO_REG_J, SWITCHES_GPIO_PIN_J) #elif defined(PCBXLITES) SWITCH_CASE (4, SWITCHES_GPIO_REG_E, SWITCHES_GPIO_PIN_E) SWITCH_CASE (5, SWITCHES_GPIO_REG_F, SWITCHES_GPIO_PIN_F) diff --git a/radio/src/targets/taranis/board.h b/radio/src/targets/taranis/board.h index b18ea02f9..57756242c 100644 --- a/radio/src/targets/taranis/board.h +++ b/radio/src/targets/taranis/board.h @@ -367,6 +367,14 @@ enum EnumSwitchesPositions SW_SH1, SW_SH2, #endif +#if defined(PCBX7) + SW_SI0, + SW_SI1, + SW_SI2, + SW_SJ0, + SW_SJ1, + SW_SJ2, +#endif #if defined(PCBX9E) SW_SI0, SW_SI1, @@ -406,7 +414,7 @@ enum EnumSwitchesPositions #elif defined(PCBXLITE) #define NUM_SWITCHES 4 #elif defined(PCBX7) - #define NUM_SWITCHES 6 + #define NUM_SWITCHES 8 #elif defined(PCBX9LITE) #define NUM_SWITCHES 5 #elif defined(PCBX9E) @@ -414,6 +422,11 @@ enum EnumSwitchesPositions #else #define NUM_SWITCHES 8 #endif + +#if defined(__cplusplus) +static_assert(NUM_SWITCHES_POSITIONS == NUM_SWITCHES * 3, "Wrong switches positions count"); +#endif + void keysInit(void); uint8_t keyState(uint8_t index); uint32_t switchState(uint8_t index); diff --git a/radio/src/targets/taranis/hal.h b/radio/src/targets/taranis/hal.h index 273d6eb3c..0a21a58d2 100644 --- a/radio/src/targets/taranis/hal.h +++ b/radio/src/targets/taranis/hal.h @@ -378,6 +378,14 @@ #define SWITCHES_GPIO_PIN_H GPIO_Pin_13 // PE.13 #endif +// X7 P400 P401 headers additionnal momentary switches +#if defined(PCBX7) + #define SWITCHES_GPIO_REG_I GPIOC->IDR + #define SWITCHES_GPIO_PIN_I GPIO_Pin_13 //PC.13 + #define SWITCHES_GPIO_REG_J GPIOC->IDR + #define SWITCHES_GPIO_PIN_J GPIO_Pin_10 //PC.10 +#endif + #if defined(PCBX9E) #define SWITCHES_GPIO_REG_I_H GPIOF->IDR #define SWITCHES_GPIO_PIN_I_H GPIO_Pin_15 // PF.15 @@ -452,7 +460,7 @@ #elif defined(PCBX7) #define KEYS_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE) #define KEYS_GPIOA_PINS SWITCHES_GPIO_PIN_B_H - #define KEYS_GPIOC_PINS (TRIMS_GPIO_PIN_LHR | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU) + #define KEYS_GPIOC_PINS (TRIMS_GPIO_PIN_LHR | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | SWITCHES_GPIO_PIN_I | SWITCHES_GPIO_PIN_J) #define KEYS_GPIOD_PINS (TRIMS_GPIO_PIN_LHL | KEYS_GPIO_PIN_MENU | KEYS_GPIO_PIN_EXIT | KEYS_GPIO_PIN_PAGE | SWITCHES_GPIO_PIN_C_L | SWITCHES_GPIO_PIN_H) #define KEYS_GPIOE_PINS (ROTARY_ENCODER_GPIO_PIN_A | ROTARY_ENCODER_GPIO_PIN_B | KEYS_GPIO_PIN_ENTER | TRIMS_GPIO_PIN_RHR | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_LVD | TRIMS_GPIO_PIN_LVU | SWITCHES_GPIO_PIN_C_H | SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_D_H | SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_A_L | SWITCHES_GPIO_PIN_A_H | SWITCHES_GPIO_PIN_F) #elif defined(PCBX9LITE) diff --git a/radio/src/tests/conversions.cpp b/radio/src/tests/conversions.cpp index f5e46bf41..ed24f699d 100644 --- a/radio/src/tests/conversions.cpp +++ b/radio/src/tests/conversions.cpp @@ -55,3 +55,39 @@ TEST(Eeprom, ConversionX9DPFrom22) EXPECT_EQ(10, g_model.telemetrySensors[0].frskyInstance.physID); } #endif + +#if defined(PCBX7) +TEST(Eeprom, ConversionX7From22) +{ + loadEEPROMFile(TESTS_PATH "/tests/eeprom_22_x7.bin"); + + eepromOpen(); + convertModelData(0, 218); + eeLoadModel(0); + + EXPECT_ZSTREQ("Test", g_model.header.name); + EXPECT_EQ(MODULE_TYPE_PXX_R9M, g_model.moduleData[EXTERNAL_MODULE].type); + EXPECT_EQ(MODULE_SUBTYPE_R9M_EU, g_model.moduleData[EXTERNAL_MODULE].subType); + EXPECT_EQ(80, g_model.mixData[0].weight); + EXPECT_EQ(80, g_model.expoData[0].weight); + EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.mixData[4].srcRaw); + EXPECT_EQ(SWSRC_TELEMETRY_STREAMING, g_model.mixData[4].swtch); + EXPECT_EQ(SWASH_TYPE_120X, g_model.swashR.type); + EXPECT_ZSTREQ("Thr", g_model.inputNames[0]); + + EXPECT_ZSTREQ("Tes", g_model.telemetrySensors[0].label); + EXPECT_EQ(10, g_model.telemetrySensors[0].id); + EXPECT_EQ(10, g_model.telemetrySensors[0].frskyInstance.physID); + EXPECT_EQ(-100, g_model.limitData[0].max); + + EXPECT_EQ(10, g_model.flightModeData[0].gvars[0]); + EXPECT_ZSTREQ("Tes", g_model.gvars[0].name); + + EXPECT_EQ(LS_FUNC_VPOS, g_model.logicalSw[0].func); + EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.logicalSw[0].v1); + EXPECT_EQ(0, g_model.logicalSw[0].v2); + + EXPECT_EQ(TELEMETRY_SCREEN_TYPE_VALUES, g_model.screensType & 0x03); + EXPECT_EQ(MIXSRC_FIRST_TRAINER, g_model.screens[0].lines[0].sources[0]); +} +#endif diff --git a/radio/src/tests/eeprom_22_x7.bin b/radio/src/tests/eeprom_22_x7.bin new file mode 100644 index 000000000..f740311ed Binary files /dev/null and b/radio/src/tests/eeprom_22_x7.bin differ diff --git a/radio/src/tests/switches.cpp b/radio/src/tests/switches.cpp index 46d69c69d..4eae3ba5c 100644 --- a/radio/src/tests/switches.cpp +++ b/radio/src/tests/switches.cpp @@ -132,7 +132,7 @@ TEST(evalLogicalSwitches, playFile) } #endif -#if defined(PCBTARANIS) && NUM_SWITCHES >= 8 +#if defined(PCBTARANIS) && NUM_SWITCHES >= 8 && !defined(PCBX7) TEST(getSwitch, edgeInstant) { MODEL_RESET(); diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index 52be84696..d1098ec63 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -417,8 +417,8 @@ #define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0" #elif defined(PCBX7) #define TR_POTS_VSRCRAW "\310S1\0""\310S2\0" - #define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SF\0""\312SH\0" -#elif defined(PCBX9LITE) + #define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SF\0""\312SH\0""\312SI\0""\312SJ\0" +#elif defined(PCBX3) #define TR_POTS_VSRCRAW "\310S1\0" #define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0" #elif defined(PCBTARANIS)