Add minimum defaults in case of error

This commit is contained in:
Theo Arends 2024-11-16 14:44:18 +01:00
parent 09c43fa729
commit de45fda781
1 changed files with 10 additions and 0 deletions

View File

@ -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();