mirror of https://github.com/arendst/Tasmota.git
Merge branch 'development' of https://github.com/arendst/Tasmota into lvgl_m5stick
This commit is contained in:
commit
6a85cd8e67
|
@ -2198,6 +2198,7 @@ void SyslogAsync(bool refresh) {
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
char log_data[len +72]; // Hostname + Id + log data
|
char log_data[len +72]; // Hostname + Id + log data
|
||||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s ESP-"), NetworkHostname());
|
snprintf_P(log_data, sizeof(log_data), PSTR("%s ESP-"), NetworkHostname());
|
||||||
uint32_t preamble_len = strlen(log_data);
|
uint32_t preamble_len = strlen(log_data);
|
||||||
|
@ -2205,6 +2206,20 @@ void SyslogAsync(bool refresh) {
|
||||||
strlcpy(log_data +preamble_len, line +mxtime, len);
|
strlcpy(log_data +preamble_len, line +mxtime, len);
|
||||||
// wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
// wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||||
PortUdp_write(log_data, preamble_len + len);
|
PortUdp_write(log_data, preamble_len + len);
|
||||||
|
*/
|
||||||
|
String log_data = NetworkHostname();
|
||||||
|
log_data += F(" ESP-");
|
||||||
|
|
||||||
|
// log_data.concat(line +mxtime, len -mxtime -1); // Add terminating \'0'
|
||||||
|
len--;
|
||||||
|
char dummy = line[len];
|
||||||
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
|
log_data.concat(line +mxtime);
|
||||||
|
line[len] = dummy;
|
||||||
|
|
||||||
|
// wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||||
|
PortUdp.write(log_data.c_str());
|
||||||
|
|
||||||
PortUdp.endPacket();
|
PortUdp.endPacket();
|
||||||
delay(1); // Add time for UDP handling (#5512)
|
delay(1); // Add time for UDP handling (#5512)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2848,9 +2848,16 @@ void HandleHttpCommand(void)
|
||||||
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
// [14:49:36.123 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}]
|
||||||
char* JSON = (char*)memchr(line, '{', len);
|
char* JSON = (char*)memchr(line, '{', len);
|
||||||
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
||||||
size_t JSONlen = len - (JSON - line);
|
|
||||||
String stemp = (cflg) ? "," : ""; // Add a comma
|
String stemp = (cflg) ? "," : ""; // Add a comma
|
||||||
stemp.concat(JSON +1, JSONlen -3); // Add a terminating '\0'
|
size_t JSONlen = len - (JSON - line);
|
||||||
|
|
||||||
|
// stemp.concat(JSON +1, JSONlen -3); // Add a terminating '\0'
|
||||||
|
len -= 2;
|
||||||
|
char dummy = line[len];
|
||||||
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
|
stemp.concat(JSON +1);
|
||||||
|
line[len] = dummy;
|
||||||
|
|
||||||
Webserver->sendContent(stemp);
|
Webserver->sendContent(stemp);
|
||||||
cflg = true;
|
cflg = true;
|
||||||
}
|
}
|
||||||
|
@ -2931,7 +2938,12 @@ void HandleConsoleRefresh(void)
|
||||||
WSContentFlush();
|
WSContentFlush();
|
||||||
while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
while (GetLog(Settings.weblog_level, &index, &line, &len)) {
|
||||||
String stemp = (cflg) ? "\n" : ""; // Add a newline
|
String stemp = (cflg) ? "\n" : ""; // Add a newline
|
||||||
stemp.concat(line, len -1); // Add a terminating '\0'
|
len--;
|
||||||
|
// stemp.concat(line, len); // Add a terminating '\0'
|
||||||
|
char dummy = line[len];
|
||||||
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
|
stemp.concat(line);
|
||||||
|
line[len] = dummy;
|
||||||
Webserver->sendContent(stemp);
|
Webserver->sendContent(stemp);
|
||||||
cflg = true;
|
cflg = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,14 @@ String TelegramExecuteCommand(const char *svalue) {
|
||||||
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O])
|
||||||
size_t JSONlen = len - (JSON - line);
|
size_t JSONlen = len - (JSON - line);
|
||||||
if (cflg) { response += F(","); }
|
if (cflg) { response += F(","); }
|
||||||
response.concat(JSON +1, JSONlen -3);
|
|
||||||
|
// response.concat(JSON +1, JSONlen -3);
|
||||||
|
len -= 2;
|
||||||
|
char dummy = line[len];
|
||||||
|
line[len] = '\0'; // Add terminating \'0'
|
||||||
|
response.concat(JSON +1);
|
||||||
|
line[len] = dummy;
|
||||||
|
|
||||||
cflg = true;
|
cflg = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue