mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-26 04:06:34 +00:00
Make sure flash erase went well
This commit is contained in:
parent
f243b06726
commit
5f1074e3f6
@ -314,7 +314,9 @@ void SetFlashModeDout(void)
|
|||||||
if (ESP.flashRead(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE)) {
|
if (ESP.flashRead(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE)) {
|
||||||
if (_buffer[2] != 3) { // DOUT
|
if (_buffer[2] != 3) { // DOUT
|
||||||
_buffer[2] = 3;
|
_buffer[2] = 3;
|
||||||
if (ESP.flashEraseSector(address / FLASH_SECTOR_SIZE)) ESP.flashWrite(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE);
|
if (ESP.flashEraseSector(address / FLASH_SECTOR_SIZE)) {
|
||||||
|
ESP.flashWrite(address, (uint32_t*)_buffer, FLASH_SECTOR_SIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] _buffer;
|
delete[] _buffer;
|
||||||
@ -412,8 +414,9 @@ void UpdateQuickPowerCycle(bool update)
|
|||||||
else if (pc_register != 0xFFA55ABF) {
|
else if (pc_register != 0xFFA55ABF) {
|
||||||
pc_register = 0xFFA55ABF;
|
pc_register = 0xFFA55ABF;
|
||||||
// Assume flash is default all ones and setting a bit to zero does not need an erase
|
// Assume flash is default all ones and setting a bit to zero does not need an erase
|
||||||
ESP.flashEraseSector(pc_location);
|
if (ESP.flashEraseSector(pc_location)) {
|
||||||
ESP.flashWrite(pc_location * SPI_FLASH_SEC_SIZE, (uint32*)&pc_register, sizeof(pc_register));
|
ESP.flashWrite(pc_location * SPI_FLASH_SEC_SIZE, (uint32*)&pc_register, sizeof(pc_register));
|
||||||
|
}
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Reset"));
|
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Reset"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,8 +467,9 @@ void SettingsSave(uint8_t rotate)
|
|||||||
Settings.cfg_crc = GetSettingsCrc(); // Keep for backward compatibility in case of fall-back just after upgrade
|
Settings.cfg_crc = GetSettingsCrc(); // Keep for backward compatibility in case of fall-back just after upgrade
|
||||||
Settings.cfg_crc32 = GetSettingsCrc32();
|
Settings.cfg_crc32 = GetSettingsCrc32();
|
||||||
|
|
||||||
ESP.flashEraseSector(settings_location);
|
if (ESP.flashEraseSector(settings_location)) {
|
||||||
ESP.flashWrite(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(SYSCFG));
|
ESP.flashWrite(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(SYSCFG));
|
||||||
|
}
|
||||||
|
|
||||||
if (!stop_flash_rotate && rotate) {
|
if (!stop_flash_rotate && rotate) {
|
||||||
for (uint32_t i = 1; i < CFG_ROTATES; i++) {
|
for (uint32_t i = 1; i < CFG_ROTATES; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user