From 6c25bce475169f963a24f7b73b2c46b5b8ecc983 Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 25 Jan 2021 14:50:19 +0100 Subject: [PATCH] Remove uneeded capabilities --- companion/src/firmwares/boards.cpp | 20 ++++++-------------- companion/src/firmwares/boards.h | 3 +-- companion/src/generaledit/hardware.cpp | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index 779712b65..28137b3ba 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -339,15 +339,11 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) else return 3; - case AvailablePots: - if (IS_JUMPER_TLITE(board)) - return 0; - else - return getCapability(board, Pots); - case FactoryInstalledPots: if (IS_TARANIS_X9(board)) return 2; + else if (IS_JUMPER_TLITE(board)) + return 0; else return getCapability(board, Pots); @@ -391,6 +387,8 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) return 7; else if (board == BOARD_TARANIS_X7) return 8; + else if (board == BOARD_JUMPER_TLITE) + return 4; else if (IS_FAMILY_T12(board)) return 8; else if (IS_TARANIS_XLITE(board)) @@ -404,20 +402,14 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) else return 7; - case AvailableSwitches: - if (IS_JUMPER_TLITE(board)) - return 4; - else - return getCapability(board, Switches); - case FactoryInstalledSwitches: if (IS_TARANIS_X9E(board)) return 8; else if (IS_JUMPER_TLITE(board)) return 4; - if (IS_FAMILY_T12(board)) + else if (IS_FAMILY_T12(board)) return 6; - if (IS_HORUS_X12S(board)) + else if (IS_HORUS_X12S(board)) return 8; else return getCapability(board, Switches); diff --git a/companion/src/firmwares/boards.h b/companion/src/firmwares/boards.h index 1f5fc0358..e871e323d 100644 --- a/companion/src/firmwares/boards.h +++ b/companion/src/firmwares/boards.h @@ -119,7 +119,6 @@ namespace Board { enum Capability { Sticks, Pots, - AvailablePots, FactoryInstalledPots, Sliders, MouseAnalogs, @@ -129,7 +128,7 @@ namespace Board { MultiposPotsPositions, Switches, SwitchPositions, - AvailableSwitches, + FactoryInstalledSwitches, NumTrims, NumTrimSwitches diff --git a/companion/src/generaledit/hardware.cpp b/companion/src/generaledit/hardware.cpp index 1d211d280..9d2e8e452 100644 --- a/companion/src/generaledit/hardware.cpp +++ b/companion/src/generaledit/hardware.cpp @@ -24,7 +24,7 @@ void HardwarePanel::setupSwitchType(int index, QLabel * label, AutoLineEdit * name, AutoComboBox * type, bool threePos) { Board::Type board = getCurrentBoard(); - if (IS_STM32(board) && index < getBoardCapability(board, Board::AvailableSwitches)) { + if (IS_STM32(board) && index < getBoardCapability(board, Board::Switches)) { type->addItem(tr("None"), Board::SWITCH_NOT_AVAILABLE); type->addItem(tr("2 Positions Toggle"), Board::SWITCH_TOGGLE); type->addItem(tr("2 Positions"), Board::SWITCH_2POS); @@ -75,7 +75,7 @@ void HardwarePanel::setupPotType(int index, QLabel * label, AutoLineEdit * name, { Board::Type board = firmware->getBoard(); - if (IS_STM32(board) && index < getBoardCapability(board, Board::AvailablePots)) { + if (IS_STM32(board) && index < getBoardCapability(board, Board::Pots)) { label->setText(RawSource(SOURCE_TYPE_STICK, CPN_MAX_STICKS+index).toString()); type->addItem(tr("None"), Board::POT_NONE); type->addItem(tr("Pot with detent"), Board::POT_WITH_DETENT);