mirror of https://github.com/arendst/Tasmota.git
v5.2.1
5.2.1 20170622 * Fix Restore Configuration in case of lower version * Revert auto configuration upgrade allowing easy upgrade which was removed in version 5.2.0 * Fix config auto upgrade from versions below version 4.1.1 (#530)
This commit is contained in:
parent
b88ec7f5a9
commit
92958f4bdd
|
@ -1,7 +1,7 @@
|
|||
## Sonoff-Tasmota
|
||||
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
|
||||
|
||||
Current version is **5.2.0** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
|
||||
Current version is **5.2.1** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
|
||||
|
||||
### **** ATTENTION Version 5.x.x specific information ****
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/* 5.2.0 20170619
|
||||
/* 5.2.1 20170622
|
||||
* Fix Restore Configuration in case of lower version
|
||||
* Revert auto configuration upgrade allowing easy upgrade which was removed in version 5.2.0
|
||||
* Fix config auto upgrade from versions below version 4.1.1 (#530)
|
||||
*
|
||||
* 5.2.0 20170619
|
||||
* Add command SetOption12 1 to disable newly released configuration flash rotate to reduce flash wear
|
||||
* Fix command CounterDebounce by removing test for active GPIO (#524)
|
||||
* Add command SetOption33 1..250 to allow user configure POW Max_Power_Retry count (#525)
|
||||
|
|
|
@ -124,6 +124,9 @@ extern "C" uint32_t _SPIFFS_end;
|
|||
|
||||
#define SPIFFS_END ((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE
|
||||
|
||||
// Version 3.x config
|
||||
#define CFG_LOCATION_3 SPIFFS_END - 4
|
||||
|
||||
// Version 4.2 config = eeprom area
|
||||
#define CFG_LOCATION SPIFFS_END // No need for SPIFFS as it uses EEPROM area
|
||||
// Version 5.2 allow for more flash space
|
||||
|
@ -258,9 +261,30 @@ void CFG_Load()
|
|||
}
|
||||
snprintf_P(log, sizeof(log), PSTR("Cnfg: Load from flash at %X and count %d"), _cfgLocation, sysCfg.saveFlag);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
/*
|
||||
if (sysCfg.cfg_holder != CFG_HOLDER) {
|
||||
CFG_Default();
|
||||
}
|
||||
*/
|
||||
if (sysCfg.cfg_holder != CFG_HOLDER) {
|
||||
// Auto upgrade
|
||||
if ((sysCfg.version < 0x04020000) || (sysCfg.version > 0x06000000)) {
|
||||
noInterrupts();
|
||||
spi_flash_read((CFG_LOCATION_3) * SPI_FLASH_SEC_SIZE, (uint32*)&sysCfg, sizeof(SYSCFG));
|
||||
spi_flash_read((CFG_LOCATION_3 + 1) * SPI_FLASH_SEC_SIZE, (uint32*)&_sysCfgH, sizeof(SYSCFGH));
|
||||
if (sysCfg.saveFlag < _sysCfgH.saveFlag)
|
||||
spi_flash_read((CFG_LOCATION_3 + 1) * SPI_FLASH_SEC_SIZE, (uint32*)&sysCfg, sizeof(SYSCFG));
|
||||
interrupts();
|
||||
if (sysCfg.cfg_holder != CFG_HOLDER) {
|
||||
CFG_Default();
|
||||
} else {
|
||||
sysCfg.saveFlag = 0;
|
||||
}
|
||||
} else {
|
||||
CFG_Default();
|
||||
}
|
||||
}
|
||||
|
||||
_cfgHash = getHash();
|
||||
|
||||
RTC_Load();
|
||||
|
@ -672,7 +696,9 @@ void CFG_Delta()
|
|||
}
|
||||
}
|
||||
if (sysCfg.version < 0x05010600) {
|
||||
if (sysCfg.version > 0x04010100) {
|
||||
memcpy(sysCfg.state_text, sysCfg.ex_state_text, 33);
|
||||
}
|
||||
strlcpy(sysCfg.state_text[3], MQTT_CMND_HOLD, sizeof(sysCfg.state_text[3]));
|
||||
}
|
||||
if (sysCfg.version < 0x05010700) {
|
||||
|
@ -683,6 +709,7 @@ void CFG_Delta()
|
|||
}
|
||||
|
||||
sysCfg.version = VERSION;
|
||||
CFG_Save(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
- Select IDE Tools - Flash size: "1M (no SPIFFS)"
|
||||
====================================================*/
|
||||
|
||||
#define VERSION 0x05020000 // 5.2.0
|
||||
#define VERSION 0x05020100 // 5.2.1
|
||||
|
||||
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
|
||||
enum week_t {Last, First, Second, Third, Fourth};
|
||||
|
|
|
@ -1232,6 +1232,10 @@ void handleUploadLoop()
|
|||
}
|
||||
CFG_DefaultSet2();
|
||||
memcpy((char*)&sysCfg +16, upload.buf +16, upload.currentSize -16);
|
||||
|
||||
memcpy((char*)&sysCfg +8, upload.buf +8, 4); // Restore version and auto upgrade
|
||||
// CFG_Delta();
|
||||
|
||||
}
|
||||
} else { // firmware
|
||||
if (!_uploaderror && (Update.write(upload.buf, upload.currentSize) != upload.currentSize)) {
|
||||
|
|
Loading…
Reference in New Issue