diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 839d48e12..4cbaad2e0 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -320,6 +320,8 @@ elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TLITEF4) set(FLAVOUR tlitef4) elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TPRO) set(FLAVOUR tpro) +elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TPROV2) + set(FLAVOUR tprov2) elseif(PCB STREQUAL X7 AND PCBREV STREQUAL T20) set(FLAVOUR t20) elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TX12) diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index 1d9d6cfd6..fcadea201 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -140,6 +140,7 @@ int Boards::getEEpromSize(Board::Type board) case BOARD_JUMPER_TLITE: case BOARD_JUMPER_TLITE_F4: case BOARD_JUMPER_TPRO: + case BOARD_JUMPER_TPROV2: case BOARD_RADIOMASTER_TX12: case BOARD_RADIOMASTER_TX12_MK2: case BOARD_RADIOMASTER_T8: @@ -186,6 +187,7 @@ int Boards::getFlashSize(Type board) case BOARD_JUMPER_TLITE: case BOARD_JUMPER_TLITE_F4: case BOARD_JUMPER_TPRO: + case BOARD_JUMPER_TPROV2: case BOARD_RADIOMASTER_TX12: case BOARD_RADIOMASTER_TX12_MK2: case BOARD_RADIOMASTER_ZORRO: @@ -225,7 +227,19 @@ SwitchInfo Boards::getSwitchInfo(Board::Type board, int index) if (index < DIM(switches)) return switches[index]; } - else if (IS_TARANIS_XLITE(board) || IS_JUMPER_TLITE(board) || IS_JUMPER_TPRO(board) || IS_BETAFPV_LR3PRO(board)) { + else if (IS_JUMPER_TPROV2(board)) { + const Board::SwitchInfo switches[] = { + {SWITCH_3POS, "SA"}, + {SWITCH_3POS, "SB"}, + {SWITCH_2POS, "SC"}, + {SWITCH_2POS, "SD"}, + {SWITCH_2POS, "SE"}, + {SWITCH_2POS, "SF"}, + }; + if (index < DIM(switches)) + return switches[index]; + } + else if (IS_TARANIS_XLITE(board) || IS_JUMPER_TLITE(board) || IS_JUMPER_TPROV1(board) || IS_BETAFPV_LR3PRO(board)) { const Board::SwitchInfo switches[] = { {SWITCH_3POS, "SA"}, {SWITCH_3POS, "SB"}, @@ -511,9 +525,11 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) board == BOARD_JUMPER_TPRO || board == BOARD_BETAFPV_LR3PRO || board == BOARD_IFLIGHT_COMMANDO8) return 4; + else if (board == BOARD_JUMPER_TPROV2) + return 6; else if (board == BOARD_FLYSKY_NV14 || board == BOARD_FLYSKY_EL18) return 8; - else if (board == BOARD_RADIOMASTER_TX12_MK2 || board == BOARD_RADIOMASTER_BOXER) + else if (board == BOARD_RADIOMASTER_TX12_MK2 || board == BOARD_RADIOMASTER_BOXER || board == BOARD_JUMPER_TPRO) return 6; else if (IS_FAMILY_T12(board)) return 8; @@ -534,7 +550,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) case FactoryInstalledSwitches: if (IS_TARANIS_X9E(board)) return 8; - else if (IS_JUMPER_TLITE(board) || IS_JUMPER_TPRO(board) || IS_BETAFPV_LR3PRO(board) || IS_IFLIGHT_COMMANDO8(board)) + else if (IS_JUMPER_TPROV2(board)) + return 6; + else if (IS_JUMPER_TLITE(board) || IS_JUMPER_TPROV1(board) || IS_BETAFPV_LR3PRO(board) || IS_IFLIGHT_COMMANDO8(board)) return 4; else if(IS_RADIOMASTER_ZORRO(board)) return 8; @@ -869,6 +887,8 @@ QString Boards::getBoardName(Board::Type board) return "Jumper T-Lite (F4 MCU)"; case BOARD_JUMPER_TPRO: return "Jumper T-Pro"; + case BOARD_JUMPER_TPROV2: + return "Jumper T-ProV2"; case BOARD_JUMPER_T16: return "Jumper T16"; case BOARD_JUMPER_T18: @@ -1109,6 +1129,7 @@ int Boards::getDefaultInternalModules(Board::Type board) case BOARD_JUMPER_TLITE: case BOARD_JUMPER_TLITE_F4: case BOARD_JUMPER_TPRO: + case BOARD_JUMPER_TPROV2: return (int)MODULE_TYPE_MULTIMODULE; case BOARD_BETAFPV_LR3PRO: diff --git a/companion/src/firmwares/boards.h b/companion/src/firmwares/boards.h index 203061e5a..efc213dff 100644 --- a/companion/src/firmwares/boards.h +++ b/companion/src/firmwares/boards.h @@ -73,6 +73,7 @@ namespace Board { BOARD_BETAFPV_LR3PRO, BOARD_IFLIGHT_COMMANDO8, BOARD_FLYSKY_EL18, + BOARD_JUMPER_TPROV2, BOARD_TYPE_COUNT, BOARD_TYPE_MAX = BOARD_TYPE_COUNT - 1 }; @@ -291,10 +292,20 @@ inline bool IS_JUMPER_TLITE(Board::Type board) } inline bool IS_JUMPER_TPRO(Board::Type board) +{ + return board == Board::BOARD_JUMPER_TPRO || board == Board::BOARD_JUMPER_TPROV2; +} + +inline bool IS_JUMPER_TPROV1(Board::Type board) { return board == Board::BOARD_JUMPER_TPRO; } +inline bool IS_JUMPER_TPROV2(Board::Type board) +{ + return board == Board::BOARD_JUMPER_TPROV2; +} + inline bool IS_JUMPER_T16(Board::Type board) { return board == Board::BOARD_JUMPER_T16; @@ -351,6 +362,7 @@ inline bool IS_FAMILY_T12(Board::Type board) board == Board::BOARD_JUMPER_TLITE || board == Board::BOARD_JUMPER_TLITE_F4 || board == Board::BOARD_JUMPER_TPRO || + board == Board::BOARD_JUMPER_TPROV2 || board == Board::BOARD_BETAFPV_LR3PRO || board == Board::BOARD_IFLIGHT_COMMANDO8; } diff --git a/companion/src/firmwares/edgetx/yaml_rawsource.cpp b/companion/src/firmwares/edgetx/yaml_rawsource.cpp index 063705c96..d7a6d065f 100644 --- a/companion/src/firmwares/edgetx/yaml_rawsource.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawsource.cpp @@ -67,11 +67,9 @@ std::string YamlRawSourceEncode(const RawSource& rhs) src_str += ")"; break; case SOURCE_TYPE_FUNCTIONSWITCH: - if (IS_JUMPER_TPRO(getCurrentBoard())) { - c += Boards::getCapability(getCurrentBoard(), Board::Switches); - c += rhs.index; - src_str += "S"; - src_str += c; + if (Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) { + src_str += "SW"; + src_str += std::to_string(rhs.index + 1); } break; case SOURCE_TYPE_CYC: @@ -153,6 +151,14 @@ RawSource YamlRawSourceDecode(const std::string& src_str) rhs = RawSource(SOURCE_TYPE_FUNCTIONSWITCH, idx); } } + } else if (val_len == 3 + && val[0] == 'S' + && val[1] == 'W' + && (val[2] >= '1' && val[2] <= '6') + && Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) { + // Customisable switches + int idx = val[2] - '1'; + rhs = RawSource(SOURCE_TYPE_FUNCTIONSWITCH, idx); } else if (val_len > 4 && val[0] == 'l' && diff --git a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp index f605699ea..885051ab9 100644 --- a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp @@ -45,11 +45,9 @@ std::string YamlRawSwitchEncode(const RawSwitch& rhs) break; case SWITCH_TYPE_FUNCTIONSWITCH: - if (IS_JUMPER_TPRO(getCurrentBoard())) { - c += Boards::getCapability(getCurrentBoard(), Board::Switches); - c += (sval - 1) / 3; - sw_str += "S"; - sw_str += c; + if (Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) { + sw_str += "SW"; + sw_str += std::to_string(1 + ((sval - 1) / 3)); sw_str += std::to_string((sval - 1) % 3); } break; @@ -141,7 +139,14 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str) rhs.type = SWITCH_TYPE_TRIM; rhs.index = tsw_idx + 1; } - + } else if (val_len >= 3 && val[0] == 'S' && val[1] == 'W' && + (val[2] >= '1' && val[2] <= '6') && + (val[3] >= '0' && val[3] <= '2') && + Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) { + // Customisable switches + int idx = val[2] - '1'; + idx = idx * 3 + (val[3] - '0' + 1); + rhs = RawSwitch(SWITCH_TYPE_FUNCTIONSWITCH, idx); } else if (val_len >= 3 && val[0] == 'S' && (val[1] >= 'A' && val[1] <= 'Z') && (val[2] >= '0' && val[2] <= '2')) { diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 1199208ec..d5339d998 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -43,7 +43,10 @@ inline int MAX_SWITCHES(Board::Type board, int version) if (IS_TARANIS_X9D(board)) return 9; - if (IS_JUMPER_TPRO(board)) + if (IS_JUMPER_TPROV2(board)) + return 12; + + if (IS_JUMPER_TPROV1(board)) return 10; if (IS_FAMILY_T12(board)) diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 1087dc75a..c9bbc06d3 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -66,6 +66,8 @@ const char * OpenTxEepromInterface::getName() return "EdgeTX for Jumper T-Lite (F4 MCU)"; case BOARD_JUMPER_TPRO: return "EdgeTX for Jumper T-Pro"; + case BOARD_JUMPER_TPROV2: + return "EdgeTX for Jumper T-Pro V2"; case BOARD_JUMPER_T16: return "EdgeTX for Jumper T16"; case BOARD_JUMPER_T18: @@ -1339,6 +1341,16 @@ void registerOpenTxFirmwares() registerOpenTxFirmware(firmware); addOpenTxRfOptions(firmware, FLEX); + /* Jumper T-Pro V2 board */ + firmware = new OpenTxFirmware(FIRMWAREID("tprov2"), QCoreApplication::translate("Firmware", "Jumper T-Pro v2"), BOARD_JUMPER_TPROV2); + addOpenTxCommonOptions(firmware); + firmware->addOption("noheli", Firmware::tr("Disable HELI menu and cyclic mix support")); + firmware->addOption("nogvars", Firmware::tr("Disable Global variables")); + firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen")); + addOpenTxFontOptions(firmware); + registerOpenTxFirmware(firmware); + addOpenTxRfOptions(firmware, FLEX); + /* Jumper T16 board */ firmware = new OpenTxFirmware(FIRMWAREID("t16"), Firmware::tr("Jumper T16 / T16+ / T16 Pro"), BOARD_JUMPER_T16); addOpenTxFrskyOptions(firmware); diff --git a/companion/src/simulation/simulatorwidget.cpp b/companion/src/simulation/simulatorwidget.cpp index 0586f35dd..987304c85 100644 --- a/companion/src/simulation/simulatorwidget.cpp +++ b/companion/src/simulation/simulatorwidget.cpp @@ -101,6 +101,7 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato radioUiWidget = new SimulatedUIWidgetJumperTLITE(simulator, this); break; case Board::BOARD_JUMPER_TPRO: + case Board::BOARD_JUMPER_TPROV2: radioUiWidget = new SimulatedUIWidgetJumperTPRO(simulator, this); break; case Board::BOARD_JUMPER_T16: