Skip to content

Commit

Permalink
Fix compile error
Browse files Browse the repository at this point in the history
Fix compile error (arendst#3618)
  • Loading branch information
arendst committed Aug 28, 2018
1 parent 4555250 commit be299a8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 1 addition & 3 deletions sonoff/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 24 additions & 22 deletions sonoff/xdrv_02_webserver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 "\"}");
Expand Down

0 comments on commit be299a8

Please sign in to comment.