Add Keep last channels values when Color command end with '=' #6799

This commit is contained in:
Stephan Hadinger 2019-11-08 20:45:15 +01:00
parent 538d40ab72
commit ae7120b068
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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)) {