From de45fda781f5b5f502459abf776286f387e87989 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:44:18 +0100 Subject: [PATCH] Add minimum defaults in case of error --- tasmota/tasmota_support/settings.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index db5aa35c2..62157156d 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -858,6 +858,8 @@ void SettingsLoad(void) { settings_crc32 = GetSettingsCrc32(); #endif // FIRMWARE_MINIMAL + SettingsMinimum(); // Set life-saving parameters if out-of-range due to reconfig Settings Area + RtcSettingsLoad(1); } @@ -928,6 +930,14 @@ void SettingsSdkErase(void) { /********************************************************************************************/ +void SettingsMinimum(void) { + // Set life-saving parameters if out-of-range due to reconfig Settings Area + if (Settings->dns_timeout < 100) { Settings->dns_timeout = DNS_TIMEOUT; } + if (Settings->mqtt_keepalive < 1) { Settings->mqtt_keepalive = MQTT_KEEPALIVE; } + if (Settings->mqtt_socket_timeout < 1) { Settings->mqtt_socket_timeout = MQTT_SOCKET_TIMEOUT; } + if (Settings->mqtt_wifi_timeout < 1) { Settings->mqtt_wifi_timeout = MQTT_WIFI_CLIENT_TIMEOUT / 100; } +} + void SettingsDefault(void) { AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_CONFIG D_USE_DEFAULTS)); SettingsDefaultSet1();