Fix berry scheme select

This commit is contained in:
Theo Arends 2023-05-27 12:33:50 +02:00
parent 7f8f75d196
commit d91e1e8bcc
2 changed files with 8 additions and 10 deletions

View File

@ -236,6 +236,7 @@ struct LIGHT {
uint8_t fixed_color_index = 1; uint8_t fixed_color_index = 1;
uint8_t pwm_offset = 0; // Offset in color buffer, used by sm16716 to drive itself RGB, and PWM for CCT (value is 0 or 3) uint8_t pwm_offset = 0; // Offset in color buffer, used by sm16716 to drive itself RGB, and PWM for CCT (value is 0 or 3)
uint8_t max_scheme = LS_MAX -1; uint8_t max_scheme = LS_MAX -1;
uint8_t last_scheme;
uint32_t wakeup_start_time = 0; uint32_t wakeup_start_time = 0;
@ -246,7 +247,7 @@ struct LIGHT {
bool fade_initialized = false; // dont't fade at startup bool fade_initialized = false; // dont't fade at startup
bool fade_running = false; bool fade_running = false;
#ifdef USE_DEVICE_GROUPS #ifdef USE_DEVICE_GROUPS
uint8_t last_scheme = 0; uint8_t last_dgr_scheme = 0;
bool devgrp_no_channels_out = false; // don't share channels with device group (e.g. if scheme set by other device) bool devgrp_no_channels_out = false; // don't share channels with device group (e.g. if scheme set by other device)
#ifdef USE_DGR_LIGHT_SEQUENCE #ifdef USE_DGR_LIGHT_SEQUENCE
uint8_t sequence_offset = 0; // number of channel changes this light is behind the master uint8_t sequence_offset = 0; // number of channel changes this light is behind the master
@ -1871,12 +1872,14 @@ void LightAnimate(void)
} }
#ifdef USE_DEVICE_GROUPS #ifdef USE_DEVICE_GROUPS
if (Settings->light_scheme != Light.last_scheme) { if (Settings->light_scheme != Light.last_dgr_scheme) {
Light.last_scheme = Settings->light_scheme; Light.last_dgr_scheme = Settings->light_scheme;
SendDeviceGroupMessage(Light.device, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_SCHEME, Settings->light_scheme); SendDeviceGroupMessage(Light.device, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_SCHEME, Settings->light_scheme);
Light.devgrp_no_channels_out = false; Light.devgrp_no_channels_out = false;
} }
#endif // USE_DEVICE_GROUPS #endif // USE_DEVICE_GROUPS
Light.last_scheme = Settings->light_scheme;
} }
if ((Settings->light_scheme < LS_MAX) || power_off) { // exclude WS281X Neopixel schemes if ((Settings->light_scheme < LS_MAX) || power_off) { // exclude WS281X Neopixel schemes
@ -2486,7 +2489,7 @@ void LightHandleDevGroupItem(void)
break; break;
case DGR_ITEM_LIGHT_SCHEME: case DGR_ITEM_LIGHT_SCHEME:
if (Settings->light_scheme != value) { if (Settings->light_scheme != value) {
Light.last_scheme = Settings->light_scheme = value; Light.last_dgr_scheme = Settings->light_scheme = value;
Light.devgrp_no_channels_out = (value != 0); Light.devgrp_no_channels_out = (value != 0);
send_state = true; send_state = true;
} }

View File

@ -197,7 +197,6 @@ struct WS2812 {
uint8_t show_next = 1; uint8_t show_next = 1;
uint8_t scheme_offset = 0; uint8_t scheme_offset = 0;
bool suspend_update = false; bool suspend_update = false;
bool scheme9;
} Ws2812; } Ws2812;
/********************************************************************************************/ /********************************************************************************************/
@ -640,9 +639,6 @@ void Ws2812ShowScheme(void)
{ {
uint32_t scheme = Settings->light_scheme - Ws2812.scheme_offset; uint32_t scheme = Settings->light_scheme - Ws2812.scheme_offset;
if (scheme != 9) {
Ws2812.scheme9 = 0;
}
#ifdef USE_NETWORK_LIGHT_SCHEMES #ifdef USE_NETWORK_LIGHT_SCHEMES
if ((scheme != 10) && (ddp_udp_up)) { if ((scheme != 10) && (ddp_udp_up)) {
ddp_udp.stop(); ddp_udp.stop();
@ -658,9 +654,8 @@ void Ws2812ShowScheme(void)
} }
break; break;
case 9: // Clear case 9: // Clear
if (!Ws2812.scheme9) { if (Settings->light_scheme != Light.last_scheme) {
Ws2812Clear(); Ws2812Clear();
Ws2812.scheme9 = 1;
} }
break; break;
#ifdef USE_NETWORK_LIGHT_SCHEMES #ifdef USE_NETWORK_LIGHT_SCHEMES