v5.7.0b - Add optional # to color value

5.7.0b
 * Add snfled UNDOCA
 * Allow # as prefix for color value for
ws2812 too
This commit is contained in:
arendst 2017-09-08 17:14:39 +02:00
parent 4f6acfa7d9
commit 53b0dad348
5 changed files with 21 additions and 7 deletions

View File

@ -1,7 +1,7 @@
## Sonoff-Tasmota ## Sonoff-Tasmota
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
Current version is **5.7.0a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. Current version is **5.7.0b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
### ATTENTION All versions ### ATTENTION All versions

View File

@ -1,4 +1,8 @@
/* 5.7.0a /* 5.7.0b
* Add snfled UNDOCA
* Allow # as prefix for color value for ws2812 too
*
* 5.7.0a
* Remove leading spaces from MQTT data * Remove leading spaces from MQTT data
* Fix webconsole special character entry * Fix webconsole special character entry
* Allow # as prefix for color value * Allow # as prefix for color value

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)" - Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/ ====================================================*/
#define VERSION 0x05070001 // 5.7.0a #define VERSION 0x05070002 // 5.7.0b
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
enum week_t {Last, First, Second, Third, Fourth}; enum week_t {Last, First, Second, Third, Fourth};

View File

@ -555,6 +555,14 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
do_cmnd_power(1, 1); do_cmnd_power(1, 1);
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_WAKEUP "\":\"" D_STARTED "\"}")); snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_WAKEUP "\":\"" D_STARTED "\"}"));
} }
else if (!strcasecmp_P(type, PSTR("UNDOCA"))) { // Theos legacy status
sl_getColor(scolor);
scolor[6] = '\0'; // RGB only
snprintf_P(svalue, ssvalue, PSTR("%s, %d, %d, 1, %d, 1"),
scolor, sysCfg.led_fade, sysCfg.led_table, sysCfg.led_speed);
mqtt_publish_topic_P(1, type, svalue);
svalue[0] = '\0';
}
else { else {
serviced = false; // Unknown command serviced = false; // Unknown command
} }

View File

@ -530,6 +530,10 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
ws2812_getColor(index, svalue, ssvalue); ws2812_getColor(index, svalue, ssvalue);
} }
else if (!strcasecmp_P(type, PSTR(D_CMND_COLOR))) { else if (!strcasecmp_P(type, PSTR(D_CMND_COLOR))) {
if (dataBuf[0] == '#') {
dataBuf++;
data_len--;
}
if (6 == data_len) { if (6 == data_len) {
ws2812_setColor(0, dataBuf); ws2812_setColor(0, dataBuf);
bitSet(power, ws_bit); bitSet(power, ws_bit);
@ -606,10 +610,8 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
} }
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SCHEME "\":%d}"), sysCfg.ws_scheme); snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SCHEME "\":%d}"), sysCfg.ws_scheme);
} }
else if (!strcmp_P(type,PSTR("UNDOCA"))) { // Theos WS2812 legacy status else if (!strcasecmp_P(type, PSTR("UNDOCA"))) { // Theos legacy status
RgbColor mcolor; RgbColor mcolor;
char mtopic[TOPSZ];
getTopic_P(mtopic, 1, sysCfg.mqtt_topic, type);
ws2812_setDim(sysCfg.ws_dimmer); ws2812_setDim(sysCfg.ws_dimmer);
mcolor = dcolor; mcolor = dcolor;
uint32_t color = (uint32_t)mcolor.R << 16; uint32_t color = (uint32_t)mcolor.R << 16;
@ -617,7 +619,7 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
color += (uint32_t)mcolor.B; color += (uint32_t)mcolor.B;
snprintf_P(svalue, ssvalue, PSTR("%06X, %d, %d, %d, %d, %d"), snprintf_P(svalue, ssvalue, PSTR("%06X, %d, %d, %d, %d, %d"),
color, sysCfg.ws_fade, sysCfg.ws_ledtable, sysCfg.ws_scheme, sysCfg.ws_speed, sysCfg.ws_width); color, sysCfg.ws_fade, sysCfg.ws_ledtable, sysCfg.ws_scheme, sysCfg.ws_speed, sysCfg.ws_width);
mqtt_publish(mtopic, svalue); mqtt_publish_topic_P(1, type, svalue);
svalue[0] = '\0'; svalue[0] = '\0';
} }
else { else {