diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index 8dd29ba..563bdb2 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -11,7 +11,6 @@ #include "config.h" #include "DCCEX.h" -#include "EEStore.h" //////////////////////////////////////////////////////////////// // @@ -68,13 +67,6 @@ void setup() // This is normally Serial but uses SerialUSB on a SAMD processor Serial.begin(115200); - // Responsibility 1b ;-) Load stuff from EEprom - (void)EEPROM; // tell compiler not to warn this is unused - EEStore::init(); -#ifdef EESTOREDEBUG - EEStore::dump(128); -#endif - // Start the WiFi interface on a MEGA, Uno cannot currently handle WiFi // NOTE: References to Serial1 are for the serial port used to connect // your wifi chip/shield. diff --git a/DCC.cpp b/DCC.cpp index 29fa9d7..956fea6 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -20,7 +20,7 @@ #include "DCC.h" #include "DCCWaveform.h" #include "DIAG.h" - +#include "EEStore.h" // This module is responsible for converting API calls into // messages to be sent to the waveform generator. @@ -45,6 +45,11 @@ __FlashStringHelper* DCC::shieldName=NULL; void DCC::begin(const __FlashStringHelper* motorShieldName, MotorDriver * mainDriver, MotorDriver* progDriver, byte timerNumber) { shieldName=(__FlashStringHelper*)motorShieldName; + + // Load stuff from EEprom + (void)EEPROM; // tell compiler not to warn this is unused + EEStore::init(); + DCCWaveform::begin(mainDriver,progDriver, timerNumber); } diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 5761845..2b62dc2 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -46,6 +46,7 @@ const int HASH_KEYWORD_ON = 2657; const int HASH_KEYWORD_DCC = 6436; const int HASH_KEYWORD_SLOW = -17209; const int HASH_KEYWORD_PROGBOOST = -6353; +const int HASH_KEYWORD_EEPROM = -7168; int DCCEXParser::stashP[MAX_PARAMS]; bool DCCEXParser::stashBusy; @@ -608,6 +609,11 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[]) DCC::setProgTrackBoost(true); return true; + case HASH_KEYWORD_EEPROM: + if (params >= 1) + EEStore::dump(p[1]); + return true; + default: // invalid/unknown break; } diff --git a/EEStore.cpp b/EEStore.cpp index f7bf061..a3d2d55 100644 --- a/EEStore.cpp +++ b/EEStore.cpp @@ -2,9 +2,7 @@ #include "Turnouts.h" #include "Sensors.h" #include "Outputs.h" -#ifdef EESTOREDEBUG #include "DIAG.h" -#endif #if defined(ARDUINO_ARCH_SAMD) ExternalEEPROM EEPROM; @@ -74,15 +72,14 @@ int EEStore::pointer(){ } /////////////////////////////////////////////////////////////////////////////// -#ifdef EESTOREDEBUG void EEStore::dump(int num) { byte b; + DIAG(F("\nAddr 0x char\n")); for (int n=0 ; n