mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-19 16:56:34 +00:00
Fix ESP32-C3 Settings backup and restore
This commit is contained in:
parent
4fe8f6bc16
commit
b7519b9c90
@ -521,18 +521,24 @@ typedef struct {
|
||||
|
||||
uint8_t ex_switchmode[8]; // 3A4 - Free since 9.2.0.6
|
||||
|
||||
myio my_gp; // 3AC 2 x 18 bytes (ESP8266) / 2 x 40 bytes (ESP32)
|
||||
myio my_gp; // 3AC 2 x 18 bytes (ESP8266) / 2 x 40 bytes (ESP32) / 2 x 22 bytes (ESP32-C3)
|
||||
#ifdef ESP8266
|
||||
uint16_t gpio16_converted; // 3D0
|
||||
uint8_t free_esp8266_3D2[42]; // 3D2
|
||||
#endif
|
||||
mytmplt user_template; // 3FC 2 x 15 bytes (ESP8266) / 2 x 37 bytes (ESP32)
|
||||
#ifdef ESP8266
|
||||
|
||||
uint8_t free_esp8266_41A[55]; // 41A
|
||||
|
||||
#endif // ESP8266
|
||||
#ifdef ESP32
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||
uint8_t free_esp32c3_3D8[36]; // 3D8 - Due to smaller myio
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C3
|
||||
#endif // ESP32
|
||||
mytmplt user_template; // 3FC 2 x 15 bytes (ESP8266) / 2 x 37 bytes (ESP32) / 2 x 23 bytes (ESP32-C3)
|
||||
#ifdef ESP8266
|
||||
uint8_t free_esp8266_41A[55]; // 41A
|
||||
#endif // ESP8266
|
||||
#ifdef ESP32
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||
uint8_t free_esp32c3_42A[28]; // 42A - Due to smaller mytmplt
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C3
|
||||
uint8_t eth_type; // 446
|
||||
uint8_t eth_clk_mode; // 447
|
||||
|
||||
|
@ -657,6 +657,7 @@ void SettingsLoad(void) {
|
||||
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
if ((0 == settings_location) || (Settings->cfg_holder != (uint16_t)CFG_HOLDER)) { // Init defaults if cfg_holder differs from user settings in my_user_config.h
|
||||
// if ((0 == settings_location) || (Settings->cfg_size != sizeof(TSettings)) || (Settings->cfg_holder != (uint16_t)CFG_HOLDER)) { // Init defaults if cfg_holder differs from user settings in my_user_config.h
|
||||
#ifdef USE_UFILESYS
|
||||
if (TfsLoadFile(TASM_FILE_SETTINGS_LKG, (uint8_t*)Settings, sizeof(TSettings)) && (Settings->cfg_crc32 == GetSettingsCrc32())) {
|
||||
settings_location = 1;
|
||||
@ -1361,6 +1362,19 @@ void SettingsDelta(void) {
|
||||
Settings->mqtt_wifi_timeout = MQTT_WIFI_CLIENT_TIMEOUT / 100;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||
if (Settings->version < 0x09050002) {
|
||||
if (Settings->cfg_size != sizeof(TSettings)) {
|
||||
// Fix onetime Settings layout due to changed ESP32-C3 myio and mytmplt types sizes
|
||||
memmove_P((uint8_t*)&Settings->user_template, (uint8_t*)&Settings->free_esp32c3_3D8, sizeof(TSettings) - 0x3FC);
|
||||
memmove_P((uint8_t*)&Settings->eth_type, (uint8_t*)&Settings->free_esp32c3_42A, sizeof(TSettings) - 0x446);
|
||||
// Reset for future use
|
||||
memset(&Settings->free_esp32c3_3D8, 0x00, sizeof(Settings->free_esp32c3_3D8));
|
||||
memset(&Settings->free_esp32c3_42A, 0x00, sizeof(Settings->free_esp32c3_42A));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Settings->version = VERSION;
|
||||
SettingsSave(1);
|
||||
}
|
||||
|
@ -20,6 +20,6 @@
|
||||
#ifndef _TASMOTA_VERSION_H_
|
||||
#define _TASMOTA_VERSION_H_
|
||||
|
||||
const uint32_t VERSION = 0x09050001;
|
||||
const uint32_t VERSION = 0x09050002;
|
||||
|
||||
#endif // _TASMOTA_VERSION_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user