From 19a8c36c0f58310f7d957e6eb803ed7e34e66716 Mon Sep 17 00:00:00 2001 From: philmoz Date: Tue, 24 Jun 2025 10:25:20 +1000 Subject: [PATCH] fix(color): switch picker for Lua scripts may show incorrect switch names (#6390) --- radio/src/gui/gui_common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index d2d2bb75b..ade940115 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -438,7 +438,7 @@ static bool switchIsAvailable(int swtch, bool invert) static bool isSwitchSwitchAvailable(int swtch, bool invert) { // Check normal switch if (swtch < MAX_SWITCHES * 3) { - div_t swinfo = switchInfo(swtch); + div_t swinfo = switchInfo(swtch + SWSRC_FIRST_SWITCH); if (swinfo.quot >= switchGetMaxSwitches() + switchGetMaxFctSwitches()) { return false; } @@ -458,7 +458,7 @@ static bool isSwitchSwitchAvailable(int swtch, bool invert) { } // Multipos switch - int index = (swtch - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT; + int index = (swtch + SWSRC_FIRST_SWITCH - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT; return (index < adcGetMaxInputs(ADC_INPUT_FLEX)) ? IS_POT_MULTIPOS(index) : false; }