Fix GUI Saturation slider gradient update when using color or dimmer command

This commit is contained in:
Theo Arends 2025-12-01 17:06:22 +01:00
parent 91e501b3d6
commit 7036057dd0

View File

@ -1926,30 +1926,34 @@ bool HandleRootStatusRefresh(void) {
#ifdef USE_LIGHT
uint16_t hue;
uint8_t sat;
bool hue_bri_change = false;
int current_value = -1;
for (uint32_t i = 0; i < LST_MAX; i++) {
if (Web.slider[i] != -1) {
if (!Settings->flag3.pwm_multi_channels) { // SetOption68 0 - Enable multi-channels PWM instead of Color PWM
if (0 == i) {
if (0 == i) { // Cold / Warm
current_value = LightGetColorTemp();
}
else if (1 == i) {
else if (1 == i) { // Hue
LightGetHSB(&hue, &sat, nullptr);
current_value = hue;
}
else if (2 == i) {
else if (2 == i) { // Saturation
current_value = changeUIntScale(sat, 0, 255, 0, 100);
}
else if (3 == i) {
else if (3 == i) { // Dimmer - Color
current_value = Settings->light_dimmer;
}
else if (4 == i) {
else if (4 == i) { // Dimmer2 - White
current_value = LightGetDimmer(2);
}
} else {
current_value = changeUIntScale(Settings->light_color[i], 0, 255, 0, 100);
}
if (current_value != Web.slider[i]) {
if ((1 == i) || (3 == i)) { // Hue or Dimmer change needs Saturation slider gradient update
hue_bri_change = true;
}
if (WebUpdateSliderTime()) {
Web.slider[i] = current_value;
}
@ -1961,6 +1965,9 @@ bool HandleRootStatusRefresh(void) {
}
}
}
if (hue_bri_change) {
WSContentSend_P(PSTR("lc('h',99,0);")); // Update Saturation slider color gradient when command color/dimmer is executed
}
#endif // USE_LIGHT
if (msg_exec_javascript) {