1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-27 14:21:25 +01:00

D EEPROM command

This commit is contained in:
Harald Barth 2020-10-04 21:20:13 +02:00
parent 75d7547f11
commit 6dc4bcdb71
5 changed files with 14 additions and 16 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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<num; n++) {
EEPROM.get(n, b);
DIAG(F("%d %x %c\n"),n,b,isascii(b) ? b : ' ');
DIAG(F("%d %x %c\n"),n,b,isascii(b) ? b : ' ');
}
}
#endif
///////////////////////////////////////////////////////////////////////////////
EEStore *EEStore::eeStore=NULL;

View File

@ -29,9 +29,7 @@ struct EEStore{
static void advance(int);
static void store();
static void clear();
#ifdef EESTOREDEBUG
static void dump(int);
#endif
};
#endif