fix(color): switch picker for Lua scripts may show incorrect switch names (#6390)

This commit is contained in:
philmoz
2025-06-24 10:25:20 +10:00
committed by GitHub
parent 520a8082bc
commit 19a8c36c0f
+2 -2
View File
@@ -438,7 +438,7 @@ static bool switchIsAvailable(int swtch, bool invert)
static bool isSwitchSwitchAvailable(int swtch, bool invert) { static bool isSwitchSwitchAvailable(int swtch, bool invert) {
// Check normal switch // Check normal switch
if (swtch < MAX_SWITCHES * 3) { if (swtch < MAX_SWITCHES * 3) {
div_t swinfo = switchInfo(swtch); div_t swinfo = switchInfo(swtch + SWSRC_FIRST_SWITCH);
if (swinfo.quot >= switchGetMaxSwitches() + switchGetMaxFctSwitches()) { if (swinfo.quot >= switchGetMaxSwitches() + switchGetMaxFctSwitches()) {
return false; return false;
} }
@@ -458,7 +458,7 @@ static bool isSwitchSwitchAvailable(int swtch, bool invert) {
} }
// Multipos switch // 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; return (index < adcGetMaxInputs(ADC_INPUT_FLEX)) ? IS_POT_MULTIPOS(index) : false;
} }