fix(color): switch picker for Lua scripts may show incorrect switch names (#6390)
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user