mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 14:57:16 +00:00
Merge pull request #9998 from s-hadinger/zigbee_zbreset_eeprom
Zigbee `ZbReset 1` also erases EEPROM
This commit is contained in:
commit
c866f90dbf
@ -391,6 +391,9 @@ void saveZigbeeDevices(void) {
|
||||
// Erase the flash area containing the ZigbeeData
|
||||
void eraseZigbeeDevices(void) {
|
||||
zigbee_devices.clean(); // avoid writing data to flash after erase
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
ZFS_Erase();
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
#ifdef ESP8266
|
||||
// first copy SPI buffer into ram
|
||||
uint8_t *spi_buffer = (uint8_t*) malloc(z_spi_len);
|
||||
@ -410,7 +413,7 @@ void eraseZigbeeDevices(void) {
|
||||
}
|
||||
|
||||
free(spi_buffer);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (0x%08X - %d bytes)"), z_dev_start, z_block_len);
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased in %s"), PSTR("Flash"));
|
||||
#else // ESP32
|
||||
ZigbeeErase();
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased (%d bytes)"), z_block_len);
|
||||
|
@ -314,6 +314,14 @@ bool loadZigbeeDevicesFromEEPROM(void) {
|
||||
zigbee_devices.clean(); // don't write back to Flash what we just loaded
|
||||
return true;
|
||||
}
|
||||
|
||||
void ZFS_Erase(void) {
|
||||
if (zigbee.eeprom_present) {
|
||||
ZFS::erase();
|
||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data erased in %s"), PSTR("EEPROM"));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
|
||||
#endif // USE_ZIGBEE
|
||||
|
@ -136,6 +136,7 @@ void CmndZbReset(void) {
|
||||
ZigbeeZNPSend(ZIGBEE_FACTORY_RESET, sizeof(ZIGBEE_FACTORY_RESET));
|
||||
#endif // USE_ZIGBEE_ZNP
|
||||
eraseZigbeeDevices();
|
||||
// no break - this is intended
|
||||
case 2: // fall through
|
||||
Settings.zb_txradio_dbm = - abs(Settings.zb_txradio_dbm);
|
||||
TasmotaGlobal.restart_flag = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user