v5.11.1i - Fix log roll-over restart (#1793)

Fix Software Watchdog restart around log roll-over (#1793)
This commit is contained in:
arendst 2018-02-06 13:50:05 +01:00
parent 0d6275fe5e
commit 150de9c99d
4 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,7 @@
* Fix IRReceive Data value (#1663) * Fix IRReceive Data value (#1663)
* Fix compiler warnings (#1774) * Fix compiler warnings (#1774)
* Fix command PWM response if no PWM channel is configured (#1783) * Fix command PWM response if no PWM channel is configured (#1783)
* Fix Software Watchdog restart around log roll-over (#1793)
* *
* 5.11.1h * 5.11.1h
* Rewrite webserver argument processing gaining 5k code space (#1705) * Rewrite webserver argument processing gaining 5k code space (#1705)

View File

@ -123,7 +123,7 @@ void RtcSettingsDump()
for (row = 0; row < maxrow; row++) { for (row = 0; row < maxrow; row++) {
idx = row * CFG_COLS; idx = row * CFG_COLS;
snprintf_P(log_data, sizeof(log_data), PSTR("%04X:"), idx); snprintf_P(log_data, sizeof(log_data), PSTR("%03X:"), idx);
for (col = 0; col < CFG_COLS; col++) { for (col = 0; col < CFG_COLS; col++) {
if (!(col%4)) { if (!(col%4)) {
snprintf_P(log_data, sizeof(log_data), PSTR("%s "), log_data); snprintf_P(log_data, sizeof(log_data), PSTR("%s "), log_data);
@ -378,7 +378,7 @@ void SettingsDump(char* parms)
for (row = srow; row < maxrow; row++) { for (row = srow; row < maxrow; row++) {
idx = row * CFG_COLS; idx = row * CFG_COLS;
snprintf_P(log_data, sizeof(log_data), PSTR("%04X:"), idx); snprintf_P(log_data, sizeof(log_data), PSTR("%03X:"), idx);
for (col = 0; col < CFG_COLS; col++) { for (col = 0; col < CFG_COLS; col++) {
if (!(col%4)) { if (!(col%4)) {
snprintf_P(log_data, sizeof(log_data), PSTR("%s "), log_data); snprintf_P(log_data, sizeof(log_data), PSTR("%s "), log_data);

View File

@ -129,7 +129,7 @@ int wifi_state_flag = WIFI_RESTART; // Wifi state flag
int uptime = 0; // Current uptime in hours int uptime = 0; // Current uptime in hours
boolean latest_uptime_flag = true; // Signal latest uptime boolean latest_uptime_flag = true; // Signal latest uptime
int tele_period = 0; // Tele period timer int tele_period = 0; // Tele period timer
byte web_log_index = 0; // Index in Web log buffer byte web_log_index = 1; // Index in Web log buffer (should never be 0)
byte reset_web_log_flag = 0; // Reset web console log byte reset_web_log_flag = 0; // Reset web console log
byte devices_present = 0; // Max number of devices supported byte devices_present = 0; // Max number of devices supported
int status_update_timer = 0; // Refresh initial status int status_update_timer = 0; // Refresh initial status

View File

@ -1405,6 +1405,7 @@ void AddLog(byte loglevel)
memmove(web_log, it, WEB_LOG_SIZE -(it-web_log)); // Move buffer forward to remove oldest log line memmove(web_log, it, WEB_LOG_SIZE -(it-web_log)); // Move buffer forward to remove oldest log line
} }
snprintf_P(web_log, sizeof(web_log), PSTR("%s%c%s%s\1"), web_log, web_log_index++, mxtime, log_data); snprintf_P(web_log, sizeof(web_log), PSTR("%s%c%s%s\1"), web_log, web_log_index++, mxtime, log_data);
if (!web_log_index) web_log_index++; // Index 0 is not allowed as it is the end of char string
} }
#endif // USE_WEBSERVER #endif // USE_WEBSERVER
if ((WL_CONNECTED == WiFi.status()) && (loglevel <= syslog_level)) { if ((WL_CONNECTED == WiFi.status()) && (loglevel <= syslog_level)) {