From 93e855ace7228949686da3fbd83ab9c02d09eba1 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 28 Aug 2018 12:39:51 +0200 Subject: [PATCH] Fix compile error Fix compile error (#3618) --- sonoff/settings.h | 4 +--- sonoff/xdrv_02_webserver.ino | 46 +++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/sonoff/settings.h b/sonoff/settings.h index b918b67ee..12c3617b2 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -194,9 +194,7 @@ struct SYSCFG { char sta_pwd[2][65]; // 0E3 char hostname[33]; // 165 char syslog_host[33]; // 186 - - byte free1A7[1]; // 1A7 - + uint8_t rule_stop; // 1A7 uint16_t syslog_port; // 1A8 byte syslog_level; // 1AA uint8_t webserver; // 1AB diff --git a/sonoff/xdrv_02_webserver.ino b/sonoff/xdrv_02_webserver.ino index b7ca9ecd8..64c138a56 100644 --- a/sonoff/xdrv_02_webserver.ino +++ b/sonoff/xdrv_02_webserver.ino @@ -1702,31 +1702,33 @@ void HandleHttpCommand() WebGetArg("cmnd", svalue, sizeof(svalue)); if (strlen(svalue)) { ExecuteWebCommand(svalue, SRC_WEBCOMMAND); - } - if (web_log_index != curridx) { - byte counter = curridx; - message = F("{"); - do { - char* tmp; - size_t len; - GetLog(counter, &tmp, &len); - if (len) { - // [14:49:36 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}] - char* JSON = (char*)memchr(tmp, '{', len); - if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O]) - if (message.length() > 1) { message += F(","); } - size_t JSONlen = len - (JSON - tmp); - strlcpy(mqtt_data, JSON +1, JSONlen -2); - message += mqtt_data; + if (web_log_index != curridx) { + byte counter = curridx; + message = F("{"); + do { + char* tmp; + size_t len; + GetLog(counter, &tmp, &len); + if (len) { + // [14:49:36 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}] + char* JSON = (char*)memchr(tmp, '{', len); + if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O]) + if (message.length() > 1) { message += F(","); } + size_t JSONlen = len - (JSON - tmp); + strlcpy(mqtt_data, JSON +1, JSONlen -2); + message += mqtt_data; + } } - } - counter++; - if (!counter) counter++; // Skip 0 as it is not allowed - } while (counter != web_log_index); - message += F("}"); + counter++; + if (!counter) counter++; // Skip 0 as it is not allowed + } while (counter != web_log_index); + message += F("}"); + } else { + message += F(D_ENABLE_WEBLOG_FOR_RESPONSE "\"}"); + } } else { - message += F(D_ENABLE_WEBLOG_FOR_RESPONSE "\"}"); + message += F(D_ENTER_COMMAND " cmnd=\"}"); } } else { message += F(D_NEED_USER_AND_PASSWORD "\"}");