fix: custom function switch initialisation should only add SW1-SW6 to group 1 (#6681)

This commit is contained in:
philmoz
2025-10-18 11:16:04 +10:00
committed by GitHub
parent 7bcb2e29ef
commit d497ef1643
2 changed files with 25 additions and 12 deletions
+12 -6
View File
@@ -106,12 +106,18 @@ void initCustomSwitches()
for (int i = 0; i < switchGetMaxSwitches(); i += 1) {
if (switchIsCustomSwitch(i)) {
uint8_t idx = switchGetCustomSwitchIdx(i);
g_model.customSwitches[idx].type = SWITCH_2POS;
g_model.customSwitches[idx].group = 1;
if (idx == 0)
g_model.customSwitches[idx].start = FS_START_ON;
else
g_model.customSwitches[idx].start = FS_START_OFF;
if (strncmp(switchGetDefaultName(i), "SW", 2) == 0) {
g_model.customSwitches[idx].type = SWITCH_2POS;
g_model.customSwitches[idx].group = 1;
if (strncmp(switchGetDefaultName(i), "SW1", 3) == 0)
g_model.customSwitches[idx].start = FS_START_ON;
else
g_model.customSwitches[idx].start = FS_START_OFF;
} else {
g_model.customSwitches[idx].type = SWITCH_GLOBAL;
g_model.customSwitches[idx].group = 0;
g_model.customSwitches[idx].start = FS_START_PREVIOUS;
}
g_model.customSwitches[idx].state = 0;
g_model.customSwitches[idx].name[0] = 0;
#if defined(FUNCTION_SWITCHES_RGB_LEDS)