diff --git a/README.md b/README.md index f8df1d700..a8e04b635 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ - ## 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. -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 @@ -60,4 +59,4 @@ The following devices are supported: ### License -This program is licensed under GPL-3.0 +This program is licensed under GPL-3.0 \ No newline at end of file diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index d369611c3..75fc205f8 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -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 * Fix settings order during startup to allow for displaying debug messages * Fix some string length issues diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index f18aedfe3..15e177344 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - 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 week_t {Last, First, Second, Third, Fourth}; @@ -890,7 +890,13 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len) uint32_t address; 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; snprintf_P(svalue, sizeof(svalue), PSTR(D_LOG_RESULT D_RECEIVED_TOPIC " %s, " D_DATA_SIZE " %d, " D_DATA " %s"), diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index b1a65feb0..c33aea731 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -102,7 +102,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "t=document.getElementById('t1');" "if(p==1){" "c=document.getElementById('c1');" - "o='&c1='+encodeURI(c.value);" + "o='&c1='+encodeURIComponent(c.value);" "c.value='';" "t.scrollTop=sn;" "}" diff --git a/sonoff/xdrv_snfled.ino b/sonoff/xdrv_snfled.ino index 0e80d18d9..28ecb98c4 100644 --- a/sonoff/xdrv_snfled.ino +++ b/sonoff/xdrv_snfled.ino @@ -479,6 +479,10 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le char *p; if ((sfl_flg > 1) && !strcasecmp_P(type, PSTR(D_CMND_COLOR))) { + if (dataBufUc[0] == '#') { + dataBufUc++; + data_len--; + } if ((2 * sfl_flg) == data_len) { for (byte i = 0; i < sfl_flg; i++) { strlcpy(scolor, dataBufUc + (i *2), 3);