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:
13
NmraDcc.cpp
13
NmraDcc.cpp
@@ -47,7 +47,11 @@
|
|||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "NmraDcc.h"
|
#include "NmraDcc.h"
|
||||||
|
#ifdef __SAMD21G18A__
|
||||||
|
#include <FlashStorage_SAMD.h>
|
||||||
|
#else
|
||||||
#include "EEPROM.h"
|
#include "EEPROM.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Uncomment to print DEBUG messages
|
// Uncomment to print DEBUG messages
|
||||||
// #define DEBUG_PRINT
|
// #define DEBUG_PRINT
|
||||||
@@ -804,9 +808,18 @@ uint8_t readEEPROM (unsigned int CV)
|
|||||||
void writeEEPROM (unsigned int CV, uint8_t Value)
|
void writeEEPROM (unsigned int CV, uint8_t Value)
|
||||||
{
|
{
|
||||||
EEPROM.write (CV, Value) ;
|
EEPROM.write (CV, Value) ;
|
||||||
|
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
noInterrupts();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
|
#if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
interrupts();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readyEEPROM()
|
bool readyEEPROM()
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ typedef struct
|
|||||||
#define PRIO_SYSTIC 8 // MUST be higher priority than DCC Irq
|
#define PRIO_SYSTIC 8 // MUST be higher priority than DCC Irq
|
||||||
#elif defined(ARDUINO_ARCH_RP2040)
|
#elif defined(ARDUINO_ARCH_RP2040)
|
||||||
#define MAXCV 256 // todo: maybe somebody knows a good define for it
|
#define MAXCV 256 // todo: maybe somebody knows a good define for it
|
||||||
|
#elif defined(ARDUINO_SAMD_ZERO)
|
||||||
|
#define MAXCV EEPROM_EMULATION_SIZE
|
||||||
#else
|
#else
|
||||||
#define MAXCV E2END // the upper limit of the CV value currently defined to max memory.
|
#define MAXCV E2END // the upper limit of the CV value currently defined to max memory.
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name=NmraDcc
|
name=NmraDcc
|
||||||
version=2.0.13
|
version=2.0.14
|
||||||
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda), Hans Tanner, bugfixes by Jueff
|
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda), Hans Tanner, bugfixes by Jueff
|
||||||
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
||||||
sentence=Enables NMRA DCC Communication
|
sentence=Enables NMRA DCC Communication
|
||||||
|
|||||||
Reference in New Issue
Block a user