From ebbab4cda87613076e2c055f19ae746407019fbe Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 13 Aug 2019 22:35:38 +0200 Subject: [PATCH] fix switch slots on lites --- companion/src/firmwares/opentx/opentxeeprom.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index ef926f666..a187717ed 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -42,7 +42,18 @@ inline int MAX_SWITCHES(Board::Type board, int version) return Boards::getCapability(board, Board::Switches); } -#define MAX_SWITCH_SLOTS(board, version) (IS_TARANIS_X9E(board) ? 32 : (version >= 219 ? 16 : 8)) // bitsize of swconfig_t / 2 (see radio/src/datastructs.h) +// bitsize of swconfig_t / 2 (see radio/src/datastructs.h) +inline int MAX_SWITCH_SLOTS(Board::Type board, int version) +{ + if (IS_TARANIS_X9E(board)) + return 32; + + if (version >= 219 && IS_TARANIS_X9D(board)) + return 16; + + return 8; +} + #define MAX_SWITCHES_POSITION(board, version) (Boards::getCapability(board, Board::SwitchPositions)) #define MAX_ROTARY_ENCODERS(board) (IS_SKY9X(board) ? 1 : 0) #define MAX_FLIGHT_MODES(board, version) 9 @@ -2325,7 +2336,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type } internalField.Append(new UnsignedField<8>(this, generalData.inactivityTimer)); - internalField.Append(new SpareBitsField<3>(this)); + internalField.Append(new SpareBitsField<3>(this)); // telemetryBaudrate if (IS_HORUS(board)) internalField.Append(new SpareBitsField<3>(this)); else if (IS_TARANIS(board))