Fix issue with Esp8266/Esp32 platform reinitializing EEPROM multiple times causing it to forget staged EEPROM changes (#196)

This commit is contained in:
Simon Billemont 2022-04-13 09:19:18 +02:00 committed by GitHub
parent 9c620a013d
commit b0153de97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -106,8 +106,12 @@ bool Esp32Platform::sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buff
uint8_t * Esp32Platform::getEepromBuffer(uint16_t size)
{
EEPROM.begin(size);
return EEPROM.getDataPtr();
uint8_t * eepromptr = EEPROM.getDataPtr();
if(eepromptr == nullptr) {
EEPROM.begin(KNX_FLASH_SIZE);
eepromptr = EEPROM.getDataPtr();
}
return eepromptr;
}
void Esp32Platform::commitToEeprom()

View File

@ -106,8 +106,12 @@ bool EspPlatform::sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer
uint8_t * EspPlatform::getEepromBuffer(uint16_t size)
{
EEPROM.begin(size);
return EEPROM.getDataPtr();
uint8_t * eepromptr = EEPROM.getDataPtr();
if(eepromptr == nullptr) {
EEPROM.begin(KNX_FLASH_SIZE);
eepromptr = EEPROM.getDataPtr();
}
return eepromptr;
}
void EspPlatform::commitToEeprom()