v5.7.0a - Add optional # to color

5.7.0a
 * Remove leading spaces from MQTT data
 * Fix webconsole special
character entry
 * Allow # as prefix for color value
This commit is contained in:
arendst 2017-09-08 12:57:08 +02:00
parent 2bac7fa037
commit 4f6acfa7d9
5 changed files with 21 additions and 7 deletions

View File

@ -1,8 +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.0** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. Current version is **5.7.0a** - 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,9 @@
/* 5.7.0 20170907 /* 5.7.0a
* Remove leading spaces from MQTT data
* Fix webconsole special character entry
* Allow # as prefix for color value
*
* 5.7.0 20170907
* Shrink module configuration webpage * Shrink module configuration webpage
* Fix settings order during startup to allow for displaying debug messages * Fix settings order during startup to allow for displaying debug messages
* Fix some string length issues * Fix some string length issues

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)" - Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/ ====================================================*/
#define VERSION 0x05070000 // 5.7.0 #define VERSION 0x05070001 // 5.7.0a
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};
@ -890,7 +890,13 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
uint32_t address; uint32_t address;
strncpy(topicBuf, topic, sizeof(topicBuf)); strncpy(topicBuf, topic, sizeof(topicBuf));
memcpy(dataBuf, data, sizeof(dataBuf)); for (i = 0; i < data_len; i++) {
if (!isspace(data[i])) {
break;
}
}
data_len -= i;
memcpy(dataBuf, data +i, sizeof(dataBuf));
dataBuf[sizeof(dataBuf)-1] = 0; dataBuf[sizeof(dataBuf)-1] = 0;
snprintf_P(svalue, sizeof(svalue), PSTR(D_LOG_RESULT D_RECEIVED_TOPIC " %s, " D_DATA_SIZE " %d, " D_DATA " %s"), snprintf_P(svalue, sizeof(svalue), PSTR(D_LOG_RESULT D_RECEIVED_TOPIC " %s, " D_DATA_SIZE " %d, " D_DATA " %s"),

View File

@ -102,7 +102,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"t=document.getElementById('t1');" "t=document.getElementById('t1');"
"if(p==1){" "if(p==1){"
"c=document.getElementById('c1');" "c=document.getElementById('c1');"
"o='&c1='+encodeURI(c.value);" "o='&c1='+encodeURIComponent(c.value);"
"c.value='';" "c.value='';"
"t.scrollTop=sn;" "t.scrollTop=sn;"
"}" "}"

View File

@ -479,6 +479,10 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
char *p; char *p;
if ((sfl_flg > 1) && !strcasecmp_P(type, PSTR(D_CMND_COLOR))) { if ((sfl_flg > 1) && !strcasecmp_P(type, PSTR(D_CMND_COLOR))) {
if (dataBufUc[0] == '#') {
dataBufUc++;
data_len--;
}
if ((2 * sfl_flg) == data_len) { if ((2 * sfl_flg) == data_len) {
for (byte i = 0; i < sfl_flg; i++) { for (byte i = 0; i < sfl_flg; i++) {
strlcpy(scolor, dataBufUc + (i *2), 3); strlcpy(scolor, dataBufUc + (i *2), 3);