added support for the SAMD_21 chip with no EEPROM using the FlashStorage_SAMD emulated EEPROM library

added disable interrupts on the ESP8266 and ESP32 to avoid a crash during FLASH Write of emulated EEPROM
bumped version to 2.0.14
This commit is contained in:
Alex Shepherd
2023-02-07 23:58:45 +13:00
parent 24d6689b24
commit 02be948ed2
3 changed files with 16 additions and 2 deletions

View File

@@ -47,7 +47,11 @@
//------------------------------------------------------------------------
#include "NmraDcc.h"
#ifdef __SAMD21G18A__
#include <FlashStorage_SAMD.h>
#else
#include "EEPROM.h"
#endif
// Uncomment to print DEBUG messages
// #define DEBUG_PRINT
@@ -804,9 +808,18 @@ uint8_t readEEPROM (unsigned int CV)
void writeEEPROM (unsigned int CV, uint8_t Value)
{
EEPROM.write (CV, Value) ;
#if defined(ESP8266) || defined(ESP32)
noInterrupts();
#endif
#if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
EEPROM.commit();
#endif
#if defined(ESP8266) || defined(ESP32)
interrupts();
#endif
}
bool readyEEPROM()