Fix GUI channel offset

Fix GUI channel offset when relays are present (#7855)
This commit is contained in:
Theo Arends 2020-03-05 14:53:51 +01:00
parent a8e369e5ce
commit f4047b4337
1 changed files with 4 additions and 3 deletions

View File

@ -1274,12 +1274,13 @@ bool HandleRootStatusRefresh(void)
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_WHITE " %s"), tmp);
ExecuteWebCommand(svalue, SRC_WEBGUI);
}
uint32_t light_device = LightDevice(); // Channel number offset
uint32_t pwm_channels = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7);
for (uint32_t j = 1; j <= pwm_channels; j++) {
snprintf_P(webindex, sizeof(webindex), PSTR("e%d"), j);
for (uint32_t j = 0; j < pwm_channels; j++) {
snprintf_P(webindex, sizeof(webindex), PSTR("e%d"), j +1);
WebGetArg(webindex, tmp, sizeof(tmp)); // 0 - 100 percent
if (strlen(tmp)) {
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_CHANNEL "%d %s"), j, tmp);
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_CHANNEL "%d %s"), j +light_device, tmp);
ExecuteWebCommand(svalue, SRC_WEBGUI);
}
}