Add compile time control over configuration corruption detection

This commit is contained in:
Theo Arends 2020-08-17 14:19:53 +02:00
parent 50ec93c336
commit 465ccc2f61
2 changed files with 6 additions and 1 deletions

View File

@ -45,6 +45,9 @@
// -- Master parameter control --------------------
#define CFG_HOLDER 4617 // [Reset 1] Change this value (max 32000) to load SECTION1 configuration parameters to flash
// If following define is disabled it increases configuration corruption detection BUT
// it only allows firmware upgrades starting from version 6.6.0.11
//#define CFG_LEGACY_LOAD // Support for firmware upgrades from version 6.0.0
// -- Project -------------------------------------
#define PROJECT "tasmota" // PROJECT is used as the default topic delimiter

View File

@ -615,7 +615,7 @@ void SettingsLoad(void) {
AddLog_P2(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings.save_flag);
}
#else // CFG_RESILIENT
// Activated with version 8.4.0.2
// Activated with version 8.4.0.2 - Fails to read any config before version 6.6.0.11
settings_location = 0;
uint32_t save_flag = 0;
uint32_t flash_location = SETTINGS_LOCATION;
@ -1169,6 +1169,7 @@ void SettingsDelta(void)
if (Settings.version != VERSION) { // Fix version dependent changes
#ifdef ESP8266
#ifdef CFG_LEGACY_LOAD
if (Settings.version < 0x06000000) {
Settings.cfg_size = sizeof(Settings);
Settings.cfg_crc = GetSettingsCrc();
@ -1304,6 +1305,7 @@ void SettingsDelta(void)
Settings.tuya_fnid_map[tuyaindex].dpid = Settings.param[P_ex_TUYA_CURRENT_ID];
}
}
#endif // CFG_LEGACY_LOAD
if (Settings.version < 0x0606000C) {
memset((char*)&Settings +0x1D6, 0x00, 16);
}