From 142911f53218b647d060d9b2e702063052be7e07 Mon Sep 17 00:00:00 2001 From: Neil Horne <15316949+elecpower@users.noreply.github.com> Date: Mon, 16 Feb 2026 12:25:58 +1100 Subject: [PATCH] fix(cpn): custom switches in switch and function lists (#7100) --- companion/src/firmwares/customfunctiondata.cpp | 3 ++- companion/src/firmwares/modeldata.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index 68ce9f1d5..42a0e2f3c 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -254,7 +254,8 @@ bool CustomFunctionData::isFuncAvailable(const int index, const ModelData * mode ((index == FuncDisableAudioAmp && !Boards::getCapability(fw->getBoard(), Board::HasAudioMuteGPIO))) || ((index == FuncRGBLed && !(Boards::getCapability(fw->getBoard(), Board::HasBlingLEDS) || Boards::getCapability(fw->getBoard(), Board::FunctionSwitchColors)))) || ((index == FuncLCDtoVideo && !IS_FATFISH_F16(fw->getBoard()))) || - ((index >= FuncPushCustomSwitch1 && index <= FuncPushCustomSwitchLast) && !Boards::getCapability(fw->getBoard(), Board::FunctionSwitches)) + ((index >= FuncPushCustomSwitch1 && index <= FuncPushCustomSwitchLast) && + !Boards::isSwitchFunc(Boards::getSwitchIndexForCFSOffset(index - FuncPushCustomSwitch1))) ); return !ret; } diff --git a/companion/src/firmwares/modeldata.cpp b/companion/src/firmwares/modeldata.cpp index cdf548a26..7926905c8 100644 --- a/companion/src/firmwares/modeldata.cpp +++ b/companion/src/firmwares/modeldata.cpp @@ -545,7 +545,7 @@ bool ModelData::isFunctionSwitchPositionAvailable(int swIndex, int swPos, const if (fs == Board::SWITCH_GLOBAL) return gs->switchConfig[swIndex].type != Board::SWITCH_NOT_AVAILABLE; - return true; + return fs != Board::SWITCH_NOT_AVAILABLE; } bool ModelData::isFunctionSwitchSourceAllowed(int index) const