From ae7120b068e0da618c2c110c60340fc7640c2250 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 8 Nov 2019 20:45:15 +0100 Subject: [PATCH] Add Keep last channels values when Color command end with '=' #6799 --- tasmota/_changelog.ino | 1 + tasmota/xdrv_04_light.ino | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index e715dd96b..f9251d943 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -4,6 +4,7 @@ * Change supported PCF8574 I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time * Change supported PCF8574A I2C address range to 0x39 - 0x3F allowing other I2C devices with address 0x38 to be used at the same time * Change supported MCP230xx I2C address range to 0x20 - 0x26 allowing other I2C devices with address 0x27 to be used at the same time + * Add Keep last channels values when Color command end with '=' #6799 * * 7.0.0.3 20191103 * Initial support for I2C driver runtime control using command I2CDriver and document I2CDEVICES.md diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index e4e9f8c9a..3362f434a 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1901,6 +1901,11 @@ bool LightColorEntry(char *buffer, uint32_t buffer_length) } memset(&Light.entry_color, 0x00, sizeof(Light.entry_color)); + // erase all channels except if the last character is '=', #6799 + while ((buffer_length > 0) && ('=' == buffer[buffer_length - 1])) { + buffer_length--; // remove all trailing '=' + memcpy(&Light.entry_color, &Light.current_color, sizeof(Light.entry_color)); + } if (strstr(buffer, ",") != nullptr) { // Decimal entry int8_t i = 0; for (str = strtok_r(buffer, ",", &p); str && i < 6; str = strtok_r(nullptr, ",", &p)) {