Skip to content

Commit

Permalink
feat(cpn): Radiomaster Pocket support (#4241)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Feerick <[email protected]>
  • Loading branch information
3djc and pfeerick authored Oct 29, 2023
1 parent 58573d3 commit a4a0ad9
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 7 deletions.
2 changes: 2 additions & 0 deletions companion/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ elseif(PCB STREQUAL X7 AND PCBREV STREQUAL ZORRO)
set(FLAVOUR zorro)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL BOXER)
set(FLAVOUR boxer)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL POCKET)
set(FLAVOUR pocket)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL LR3PRO)
set(FLAVOUR lr3pro)
elseif(PCB STREQUAL X7 AND PCBREV STREQUAL COMMANDO8)
Expand Down
29 changes: 27 additions & 2 deletions companion/src/firmwares/boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ int Boards::getEEpromSize(Board::Type board)
case BOARD_RADIOMASTER_T8:
case BOARD_RADIOMASTER_ZORRO:
case BOARD_RADIOMASTER_BOXER:
case BOARD_RADIOMASTER_POCKET:
return EESIZE_TARANIS;
case BOARD_UNKNOWN:
return EESIZE_MAX;
Expand Down Expand Up @@ -195,6 +196,7 @@ int Boards::getFlashSize(Type board)
case BOARD_RADIOMASTER_ZORRO:
case BOARD_RADIOMASTER_BOXER:
case BOARD_RADIOMASTER_T8:
case BOARD_RADIOMASTER_POCKET:
return FSIZE_TARANIS;
case BOARD_HORUS_X12S:
case BOARD_X10:
Expand Down Expand Up @@ -330,6 +332,17 @@ SwitchInfo Boards::getSwitchInfo(Board::Type board, int index)
if (index < DIM(switches))
return switches[index];
}
else if (IS_RADIOMASTER_POCKET(board)) {
const Board::SwitchInfo switches[] = {
{SWITCH_2POS, "SA"},
{SWITCH_3POS, "SB"},
{SWITCH_3POS, "SC"},
{SWITCH_2POS, "SD"},
{SWITCH_TOGGLE, "SE"}
};
if (index < DIM(switches))
return switches[index];
}
else if (IS_RADIOMASTER_T8(board)) {
const Board::SwitchInfo switches[] = {
{SWITCH_TOGGLE, "SA"},
Expand Down Expand Up @@ -470,7 +483,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 4;

case Pots:
if (IS_TARANIS_X9LITE(board))
if (IS_TARANIS_X9LITE(board) || IS_RADIOMASTER_POCKET(board))
return 1;
else if (IS_JUMPER_TLITE(board) || IS_BETAFPV_LR3PRO(board) || IS_IFLIGHT_COMMANDO8(board))
return 0;
Expand Down Expand Up @@ -547,6 +560,8 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 8;
else if (board == BOARD_RADIOMASTER_TX12_MK2 || board == BOARD_RADIOMASTER_BOXER || board == BOARD_JUMPER_TPRO)
return 6;
else if (board == BOARD_RADIOMASTER_POCKET)
return 5;
else if (IS_FAMILY_T12(board))
return 8;
else if (IS_TARANIS_XLITE(board))
Expand Down Expand Up @@ -575,6 +590,8 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
return 4;
else if(IS_RADIOMASTER_ZORRO(board))
return 8;
else if (board == BOARD_RADIOMASTER_POCKET)
return 5;
else if (IS_FAMILY_T12(board))
return 6;
else if (IS_HORUS_X12S(board))
Expand Down Expand Up @@ -642,7 +659,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
case HasTrainerModuleSBUS:
return ((IS_TARANIS_X9LITE(board) || (IS_TARANIS_XLITE(board) && !IS_TARANIS_X9LITES(board)) ||
IS_TARANIS_X9DP_2019(board) || IS_TARANIS_X7_ACCESS(board) || IS_RADIOMASTER_ZORRO(board) ||
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board)) ||
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_POCKET(board)) ||
(getCapability(board, HasExternalModuleSupport) && (IS_TARANIS(board) && !IS_FAMILY_T12(board))));

default:
Expand Down Expand Up @@ -752,6 +769,10 @@ StringTagMappingTable Boards::getAnalogNamesLookupTable(Board::Type board, const
{tr("S2").toStdString(), "POT2"},
{tr("S3").toStdString(), "POT3"},
});
} else if (IS_RADIOMASTER_POCKET(board)) {
tbl.insert(tbl.end(), {
{tr("S1").toStdString(), "P1", 4},
});
} else if ((IS_TARANIS_SMALL(board) && !IS_JUMPER_TLITE(board) && !IS_JUMPER_T20(board)) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) {
if (version < adcVersion) {
tbl.insert(tbl.end(), {
Expand Down Expand Up @@ -935,6 +956,8 @@ QString Boards::getBoardName(Board::Type board)
return "Radiomaster Zorro";
case BOARD_RADIOMASTER_BOXER:
return "Radiomaster Boxer";
case BOARD_RADIOMASTER_POCKET:
return "Radiomaster Pocket";
case BOARD_RADIOMASTER_T8:
return "Radiomaster T8";
case BOARD_FLYSKY_NV14:
Expand Down Expand Up @@ -1180,6 +1203,7 @@ int Boards::getDefaultInternalModules(Board::Type board)
case BOARD_BETAFPV_LR3PRO:
case BOARD_RADIOMASTER_ZORRO:
case BOARD_RADIOMASTER_BOXER:
case BOARD_RADIOMASTER_POCKET:
case BOARD_RADIOMASTER_TX12_MK2:
case BOARD_IFLIGHT_COMMANDO8:
case BOARD_JUMPER_T20:
Expand Down Expand Up @@ -1211,6 +1235,7 @@ int Boards::getDefaultExternalModuleSize(Board::Type board)

if (IS_TARANIS_X9LITE(board) ||
IS_RADIOMASTER_ZORRO(board) ||
IS_RADIOMASTER_POCKET(board) ||
IS_JUMPER_TLITE(board) ||
IS_JUMPER_TPRO(board) ||
IS_JUMPER_T20(board) ||
Expand Down
8 changes: 8 additions & 0 deletions companion/src/firmwares/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace Board {
BOARD_IFLIGHT_COMMANDO8,
BOARD_FLYSKY_EL18,
BOARD_JUMPER_TPROV2,
BOARD_RADIOMASTER_POCKET,
BOARD_TYPE_COUNT,
BOARD_TYPE_MAX = BOARD_TYPE_COUNT - 1
};
Expand Down Expand Up @@ -353,6 +354,12 @@ inline bool IS_RADIOMASTER_BOXER(Board::Type board)
return board == Board::BOARD_RADIOMASTER_BOXER;
}

inline bool IS_RADIOMASTER_POCKET(Board::Type board)
{
return board == Board::BOARD_RADIOMASTER_POCKET;
}


inline bool IS_RADIOMASTER_T8(Board::Type board)
{
return board == Board::BOARD_RADIOMASTER_T8;
Expand All @@ -375,6 +382,7 @@ inline bool IS_FAMILY_T12(Board::Type board)
board == Board::BOARD_RADIOMASTER_TX12_MK2 ||
board == Board::BOARD_RADIOMASTER_ZORRO ||
board == Board::BOARD_RADIOMASTER_BOXER ||
board == Board::BOARD_RADIOMASTER_POCKET ||
board == Board::BOARD_RADIOMASTER_T8 ||
board == Board::BOARD_BETAFPV_LR3PRO ||
board == Board::BOARD_IFLIGHT_COMMANDO8;
Expand Down
3 changes: 3 additions & 0 deletions companion/src/firmwares/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ void GeneralSettings::setDefaultControlTypes(Board::Type board)
potConfig[1] = Board::POT_WITH_DETENT;
potConfig[2] = Board::POT_MULTIPOS_SWITCH;
}
else if(IS_RADIOMASTER_POCKET(board)) {
potConfig[0] = Board::POT_WITHOUT_DETENT;
}
else if(IS_JUMPER_T20(board)) {
potConfig[0] = Board::POT_WITHOUT_DETENT;
potConfig[1] = Board::POT_WITHOUT_DETENT;
Expand Down
22 changes: 18 additions & 4 deletions companion/src/firmwares/opentx/opentxinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ const char * OpenTxEepromInterface::getName()
return "EdgeTX for Radiomaster Zorro";
case BOARD_RADIOMASTER_BOXER:
return "EdgeTX for Radiomaster Boxer";
case BOARD_RADIOMASTER_POCKET:
return "EdgeTX for Radiomaster Pocket";
case BOARD_RADIOMASTER_T8:
return "EdgeTX for Radiomaster T8";
case BOARD_TARANIS_X9D:
Expand Down Expand Up @@ -772,7 +774,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
return IS_FAMILY_T16(board);
case HasVCPSerialMode:
return IS_FAMILY_HORUS_OR_T16(board) || IS_RADIOMASTER_ZORRO(board) ||
IS_JUMPER_TPRO(board) || IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board);
IS_JUMPER_TPRO(board) || IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_POCKET(board);
case HasBluetooth:
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) ||
IS_TARANIS_X9DP_2019(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) ? true : false;
Expand All @@ -792,20 +794,22 @@ int OpenTxFirmware::getCapability(::Capability capability)
IS_TARANIS_X9LITE(board) || IS_RADIOMASTER_TX12(board) ||
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_ZORRO(board) ||
IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_TX16S(board) ||
IS_JUMPER_T18(board)) || IS_JUMPER_T20(board);
IS_JUMPER_T18(board) || IS_JUMPER_T20(board) ||
IS_RADIOMASTER_POCKET(board));
case HasSoftwareSerialPower:
return IS_RADIOMASTER_TX16S(board);
case HasIntModuleMulti:
return id.contains("internalmulti") || IS_RADIOMASTER_TX16S(board) || IS_JUMPER_T18(board) ||
IS_RADIOMASTER_TX12(board) || IS_JUMPER_TLITE(board) || IS_BETAFPV_LR3PRO(board) ||
(IS_RADIOMASTER_ZORRO(board) && !id.contains("internalelrs")) ||
(IS_RADIOMASTER_BOXER(board) && !id.contains("internalelrs"));
(IS_RADIOMASTER_BOXER(board) && !id.contains("internalelrs")) ||
(IS_RADIOMASTER_POCKET(board) && !id.contains("internalelrs"));
case HasIntModuleCRSF:
return id.contains("internalcrsf");
case HasIntModuleELRS:
return id.contains("internalelrs") || IS_RADIOMASTER_TX12_MK2(board) ||
IS_IFLIGHT_COMMANDO8(board) || IS_RADIOMASTER_BOXER(board) ||
IS_JUMPER_T20(board);
IS_RADIOMASTER_POCKET(board) || IS_JUMPER_T20(board);
case HasIntModuleFlySky:
return id.contains("afhds2a") || id.contains("afhds3") ||
IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board);
Expand Down Expand Up @@ -1410,6 +1414,16 @@ void registerOpenTxFirmwares()
registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);

/* Radiomaster Pocket board */
firmware = new OpenTxFirmware(FIRMWAREID("pocket"), QCoreApplication::translate("Firmware", "Radiomaster Pocket"), Board::BOARD_RADIOMASTER_POCKET);
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 + AFHDS2A + AFHDS3);

/* Radiomaster T8 board */
firmware = new OpenTxFirmware(FIRMWAREID("t8"), QCoreApplication::translate("Firmware", "Radiomaster T8"), BOARD_RADIOMASTER_T8);
addOpenTxCommonOptions(firmware);
Expand Down
2 changes: 1 addition & 1 deletion tools/build-companion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ cd build
declare -a simulator_plugins=(x9lite x9lites
x7 x7-access
t8 t12 tx12 tx12mk2
zorro pocket commando8 boxer
zorro commando8 boxer
tlite tpro lr3pro
x9d x9dp x9dp2019 x9e
xlite xlites
Expand Down

0 comments on commit a4a0ad9

Please sign in to comment.