diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index f64d7b244..42635ea3a 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -9,6 +9,7 @@ * Fix IRReceive Data value (#1663) * Fix compiler warnings (#1774) * Fix command PWM response if no PWM channel is configured (#1783) + * Fix Software Watchdog restart around log roll-over (#1793) * * 5.11.1h * Rewrite webserver argument processing gaining 5k code space (#1705) diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 710598e9c..46f16f688 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -123,7 +123,7 @@ void RtcSettingsDump() for (row = 0; row < maxrow; row++) { 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++) { if (!(col%4)) { 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++) { 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++) { if (!(col%4)) { snprintf_P(log_data, sizeof(log_data), PSTR("%s "), log_data); diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index ba3ab1fcc..c21b31a49 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -129,7 +129,7 @@ int wifi_state_flag = WIFI_RESTART; // Wifi state flag int uptime = 0; // Current uptime in hours boolean latest_uptime_flag = true; // Signal latest uptime 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 devices_present = 0; // Max number of devices supported int status_update_timer = 0; // Refresh initial status diff --git a/sonoff/support.ino b/sonoff/support.ino index 2ece5455a..d3a597d48 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -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 } 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 if ((WL_CONNECTED == WiFi.status()) && (loglevel <= syslog_level)) {