From b6e62bf71583124994e91d0c1ebb0bb746d14b6c Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Mon, 27 Apr 2020 22:26:32 -0500 Subject: [PATCH 1/2] Only advance to next palette color when fade is down --- tasmota/xdrv_04_light.ino | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 9aaa9c9c0..971c0b2b2 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1702,17 +1702,19 @@ void LightCycleColor(int8_t direction) #ifdef USE_LIGHT_PALETTE if (Light.palette_count) { - if (0 == direction) { - Light.wheel = random(Light.palette_count); - } - else { - Light.wheel += direction; - if (Light.wheel >= Light.palette_count) { - Light.wheel = 0; - if (direction < 0) Light.wheel = Light.palette_count - 1; + if (!Light.fade_running) { + if (0 == direction) { + Light.wheel = random(Light.palette_count); } + else { + Light.wheel += direction; + if (Light.wheel >= Light.palette_count) { + Light.wheel = 0; + if (direction < 0) Light.wheel = Light.palette_count - 1; + } + } + LightSetPaletteEntry(); } - LightSetPaletteEntry(); return; } #endif // USE_LIGHT_PALETTE From 966d3522ad830920a26dfa3bfcfe9db279d0b4d9 Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Tue, 28 Apr 2020 00:18:40 -0500 Subject: [PATCH 2/2] Rework DGR channel update --- tasmota/xdrv_04_light.ino | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 971c0b2b2..345951696 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -2234,27 +2234,21 @@ void calcGammaBulbs(uint16_t cur_col_10[5]) { } #ifdef USE_DEVICE_GROUPS -void LightSendDeviceGroupStatus(bool force) +void LightSendDeviceGroupStatus(bool status) { - static uint8_t last_channels[LST_MAX]; - static uint8_t channels_sequence = 0; static uint8_t last_bri; - uint8_t bri = light_state.getBri(); - bool send_bri_update = (force || bri != last_bri); - + bool send_bri_update = (status || bri != last_bri); if (Light.subtype > LST_SINGLE && !Light.devgrp_no_channels_out) { - uint8_t channels[LST_MAX + 1]; - light_state.getChannels(channels); - if (force || memcmp(last_channels, channels, LST_MAX) -#ifdef USE_LIGHT_PALETTE - || (Settings.light_scheme && Light.palette_count) -#endif // USE_LIGHT_PALETTE - ) { - memcpy(last_channels, channels, LST_MAX); - channels[LST_MAX] = ++channels_sequence; - SendLocalDeviceGroupMessage((send_bri_update ? DGR_MSGTYP_PARTIAL_UPDATE : DGR_MSGTYP_UPDATE), DGR_ITEM_LIGHT_CHANNELS, channels); + static uint8_t channels[LST_MAX + 1] = { 0, 0, 0, 0, 0, 0 }; + if (status) { + light_state.getChannels(channels); } + else { + memcpy(channels, Light.new_color, LST_MAX); + channels[LST_MAX]++; + } + SendLocalDeviceGroupMessage((send_bri_update ? DGR_MSGTYP_PARTIAL_UPDATE : DGR_MSGTYP_UPDATE), DGR_ITEM_LIGHT_CHANNELS, channels); } if (send_bri_update) { last_bri = bri;