mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 08:06:13 +01:00
make it possible to disable EEPROM code to save flash space
This commit is contained in:
parent
6c75563779
commit
1807189183
4
DCC.cpp
4
DCC.cpp
|
@ -20,7 +20,9 @@
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include "DCC.h"
|
#include "DCC.h"
|
||||||
#include "DCCWaveform.h"
|
#include "DCCWaveform.h"
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
#include "EEStore.h"
|
#include "EEStore.h"
|
||||||
|
#endif
|
||||||
#include "GITHUB_SHA.h"
|
#include "GITHUB_SHA.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "FSH.h"
|
#include "FSH.h"
|
||||||
|
@ -56,9 +58,11 @@ void DCC::begin(const FSH * motorShieldName, MotorDriver * mainDriver, MotorDriv
|
||||||
// Initialise HAL layer before reading EEprom.
|
// Initialise HAL layer before reading EEprom.
|
||||||
IODevice::begin();
|
IODevice::begin();
|
||||||
|
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Load stuff from EEprom
|
// Load stuff from EEprom
|
||||||
(void)EEPROM; // tell compiler not to warn this is unused
|
(void)EEPROM; // tell compiler not to warn this is unused
|
||||||
EEStore::init();
|
EEStore::init();
|
||||||
|
#endif
|
||||||
|
|
||||||
DCCWaveform::begin(mainDriver,progDriver);
|
DCCWaveform::begin(mainDriver,progDriver);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,9 @@ const int16_t HASH_KEYWORD_ON = 2657;
|
||||||
const int16_t HASH_KEYWORD_DCC = 6436;
|
const int16_t HASH_KEYWORD_DCC = 6436;
|
||||||
const int16_t HASH_KEYWORD_SLOW = -17209;
|
const int16_t HASH_KEYWORD_SLOW = -17209;
|
||||||
const int16_t HASH_KEYWORD_PROGBOOST = -6353;
|
const int16_t HASH_KEYWORD_PROGBOOST = -6353;
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
const int16_t HASH_KEYWORD_EEPROM = -7168;
|
const int16_t HASH_KEYWORD_EEPROM = -7168;
|
||||||
|
#endif
|
||||||
const int16_t HASH_KEYWORD_LIMIT = 27413;
|
const int16_t HASH_KEYWORD_LIMIT = 27413;
|
||||||
const int16_t HASH_KEYWORD_MAX = 16244;
|
const int16_t HASH_KEYWORD_MAX = 16244;
|
||||||
const int16_t HASH_KEYWORD_MIN = 15978;
|
const int16_t HASH_KEYWORD_MIN = 15978;
|
||||||
|
@ -278,7 +280,9 @@ void DCCEXParser::parse(const FSH * cmd) {
|
||||||
|
|
||||||
void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||||
{
|
{
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
(void)EEPROM; // tell compiler not to warn this is unused
|
(void)EEPROM; // tell compiler not to warn this is unused
|
||||||
|
#endif
|
||||||
if (Diag::CMD)
|
if (Diag::CMD)
|
||||||
DIAG(F("PARSING:%s"), com);
|
DIAG(F("PARSING:%s"), com);
|
||||||
int16_t p[MAX_COMMAND_PARAMS];
|
int16_t p[MAX_COMMAND_PARAMS];
|
||||||
|
@ -540,6 +544,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||||
// TODO Send stats of speed reminders table
|
// TODO Send stats of speed reminders table
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
case 'E': // STORE EPROM <E>
|
case 'E': // STORE EPROM <E>
|
||||||
EEStore::store();
|
EEStore::store();
|
||||||
StringFormatter::send(stream, F("<e %d %d %d>\n"), EEStore::eeStore->data.nTurnouts, EEStore::eeStore->data.nSensors, EEStore::eeStore->data.nOutputs);
|
StringFormatter::send(stream, F("<e %d %d %d>\n"), EEStore::eeStore->data.nTurnouts, EEStore::eeStore->data.nSensors, EEStore::eeStore->data.nOutputs);
|
||||||
|
@ -549,7 +554,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||||
EEStore::clear();
|
EEStore::clear();
|
||||||
StringFormatter::send(stream, F("<O>\n"));
|
StringFormatter::send(stream, F("<O>\n"));
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
case ' ': // < >
|
case ' ': // < >
|
||||||
StringFormatter::send(stream, F("\n"));
|
StringFormatter::send(stream, F("\n"));
|
||||||
return;
|
return;
|
||||||
|
@ -865,10 +870,12 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||||
break; // and <X> if we didnt restart
|
break; // and <X> if we didnt restart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
case HASH_KEYWORD_EEPROM: // <D EEPROM NumEntries>
|
case HASH_KEYWORD_EEPROM: // <D EEPROM NumEntries>
|
||||||
if (params >= 2)
|
if (params >= 2)
|
||||||
EEStore::dump(p[1]);
|
EEStore::dump(p[1]);
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
case HASH_KEYWORD_SPEED28:
|
case HASH_KEYWORD_SPEED28:
|
||||||
DCC::setGlobalSpeedsteps(28);
|
DCC::setGlobalSpeedsteps(28);
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
#include "EEStore.h"
|
#include "EEStore.h"
|
||||||
|
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
|
@ -103,3 +106,4 @@ void EEStore::dump(int num) {
|
||||||
|
|
||||||
EEStore *EEStore::eeStore = NULL;
|
EEStore *EEStore::eeStore = NULL;
|
||||||
int EEStore::eeAddress = 0;
|
int EEStore::eeAddress = 0;
|
||||||
|
#endif
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
#ifndef EEStore_h
|
#ifndef EEStore_h
|
||||||
#define EEStore_h
|
#define EEStore_h
|
||||||
|
|
||||||
|
@ -52,3 +53,4 @@ struct EEStore{
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif // DISABLE_EEPROM
|
||||||
|
|
|
@ -82,7 +82,9 @@ the state of any outputs being monitored or controlled by a separate interface o
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#include "Outputs.h"
|
#include "Outputs.h"
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
#include "EEStore.h"
|
#include "EEStore.h"
|
||||||
|
#endif
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
#include "IODevice.h"
|
#include "IODevice.h"
|
||||||
|
|
||||||
|
@ -102,10 +104,11 @@ void Output::activate(uint16_t s){
|
||||||
data.active = s; // if s>0, set status to active, else inactive
|
data.active = s; // if s>0, set status to active, else inactive
|
||||||
// set state of output pin to HIGH or LOW depending on whether bit zero of iFlag is set to 0 (ACTIVE=HIGH) or 1 (ACTIVE=LOW)
|
// set state of output pin to HIGH or LOW depending on whether bit zero of iFlag is set to 0 (ACTIVE=HIGH) or 1 (ACTIVE=LOW)
|
||||||
IODevice::write(data.pin, s ^ data.invert);
|
IODevice::write(data.pin, s ^ data.invert);
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Update EEPROM if output has been stored.
|
// Update EEPROM if output has been stored.
|
||||||
if(EEStore::eeStore->data.nOutputs > 0 && num > 0)
|
if(EEStore::eeStore->data.nOutputs > 0 && num > 0)
|
||||||
EEPROM.put(num, data.oStatus);
|
EEPROM.put(num, data.oStatus);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -141,7 +144,7 @@ bool Output::remove(uint16_t n){
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Static function to load configuration and state of all Outputs from EEPROM
|
// Static function to load configuration and state of all Outputs from EEPROM
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
void Output::load(){
|
void Output::load(){
|
||||||
struct OutputData data;
|
struct OutputData data;
|
||||||
Output *tt;
|
Output *tt;
|
||||||
|
@ -176,6 +179,7 @@ void Output::store(){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Static function to create an Output object
|
// Static function to create an Output object
|
||||||
|
|
|
@ -48,8 +48,10 @@ public:
|
||||||
bool isActive();
|
bool isActive();
|
||||||
static Output* get(uint16_t);
|
static Output* get(uint16_t);
|
||||||
static bool remove(uint16_t);
|
static bool remove(uint16_t);
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
static void load();
|
static void load();
|
||||||
static void store();
|
static void store();
|
||||||
|
#endif
|
||||||
static Output *create(uint16_t, VPIN, int, int=0);
|
static Output *create(uint16_t, VPIN, int, int=0);
|
||||||
static Output *firstOutput;
|
static Output *firstOutput;
|
||||||
struct OutputData data;
|
struct OutputData data;
|
||||||
|
|
|
@ -68,7 +68,9 @@ decide to ignore the <q ID> return and only react to <Q ID> triggers.
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
#include "Sensors.h"
|
#include "Sensors.h"
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
#include "EEStore.h"
|
#include "EEStore.h"
|
||||||
|
#endif
|
||||||
#include "IODevice.h"
|
#include "IODevice.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,7 +277,7 @@ bool Sensor::remove(int n){
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
void Sensor::load(){
|
void Sensor::load(){
|
||||||
struct SensorData data;
|
struct SensorData data;
|
||||||
Sensor *tt;
|
Sensor *tt;
|
||||||
|
@ -303,7 +305,7 @@ void Sensor::store(){
|
||||||
EEStore::eeStore->data.nSensors++;
|
EEStore::eeStore->data.nSensors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Sensor *Sensor::firstSensor=NULL;
|
Sensor *Sensor::firstSensor=NULL;
|
||||||
|
|
|
@ -68,8 +68,10 @@ public:
|
||||||
Sensor *nextSensor;
|
Sensor *nextSensor;
|
||||||
|
|
||||||
void setState(int state);
|
void setState(int state);
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
static void load();
|
static void load();
|
||||||
static void store();
|
static void store();
|
||||||
|
#endif
|
||||||
static Sensor *create(int id, VPIN vpin, int pullUp);
|
static Sensor *create(int id, VPIN vpin, int pullUp);
|
||||||
static Sensor* get(int id);
|
static Sensor* get(int id);
|
||||||
static bool remove(int id);
|
static bool remove(int id);
|
||||||
|
|
28
Turnouts.cpp
28
Turnouts.cpp
|
@ -22,7 +22,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include "defines.h" // includes config.h
|
#include "defines.h" // includes config.h
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
#include "EEStore.h"
|
#include "EEStore.h"
|
||||||
|
#endif
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
#include "RMFT2.h"
|
#include "RMFT2.h"
|
||||||
#include "Turnouts.h"
|
#include "Turnouts.h"
|
||||||
|
@ -142,10 +144,12 @@
|
||||||
if (ok) {
|
if (ok) {
|
||||||
turnoutlistHash++; // let withrottle know something changed
|
turnoutlistHash++; // let withrottle know something changed
|
||||||
|
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Write byte containing new closed/thrown state to EEPROM if required. Note that eepromAddress
|
// Write byte containing new closed/thrown state to EEPROM if required. Note that eepromAddress
|
||||||
// is always zero for LCN turnouts.
|
// is always zero for LCN turnouts.
|
||||||
if (EEStore::eeStore->data.nTurnouts > 0 && tt->_eepromAddress > 0)
|
if (EEStore::eeStore->data.nTurnouts > 0 && tt->_eepromAddress > 0)
|
||||||
EEPROM.put(tt->_eepromAddress, tt->_turnoutData.flags);
|
EEPROM.put(tt->_eepromAddress, tt->_turnoutData.flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(RMFT_ACTIVE)
|
#if defined(RMFT_ACTIVE)
|
||||||
RMFT2::turnoutEvent(id, closeFlag);
|
RMFT2::turnoutEvent(id, closeFlag);
|
||||||
|
@ -159,6 +163,7 @@
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Load all turnout objects
|
// Load all turnout objects
|
||||||
/* static */ void Turnout::load() {
|
/* static */ void Turnout::load() {
|
||||||
for (uint16_t i=0; i<EEStore::eeStore->data.nTurnouts; i++) {
|
for (uint16_t i=0; i<EEStore::eeStore->data.nTurnouts; i++) {
|
||||||
|
@ -212,7 +217,7 @@
|
||||||
#endif
|
#endif
|
||||||
return tt;
|
return tt;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Display, on the specified stream, the current state of the turnout (1=thrown or 0=closed).
|
// Display, on the specified stream, the current state of the turnout (1=thrown or 0=closed).
|
||||||
/* static */ void Turnout::printState(uint16_t id, Print *stream) {
|
/* static */ void Turnout::printState(uint16_t id, Print *stream) {
|
||||||
Turnout *tt = get(id);
|
Turnout *tt = get(id);
|
||||||
|
@ -277,6 +282,7 @@
|
||||||
|
|
||||||
// Load a Servo turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
// Load a Servo turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
||||||
Turnout *ServoTurnout::load(struct TurnoutData *turnoutData) {
|
Turnout *ServoTurnout::load(struct TurnoutData *turnoutData) {
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
ServoTurnoutData servoTurnoutData;
|
ServoTurnoutData servoTurnoutData;
|
||||||
// Read class-specific data from EEPROM
|
// Read class-specific data from EEPROM
|
||||||
EEPROM.get(EEStore::pointer(), servoTurnoutData);
|
EEPROM.get(EEStore::pointer(), servoTurnoutData);
|
||||||
|
@ -286,6 +292,10 @@
|
||||||
Turnout *tt = ServoTurnout::create(turnoutData->id, servoTurnoutData.vpin, servoTurnoutData.thrownPosition,
|
Turnout *tt = ServoTurnout::create(turnoutData->id, servoTurnoutData.vpin, servoTurnoutData.thrownPosition,
|
||||||
servoTurnoutData.closedPosition, servoTurnoutData.profile, turnoutData->closed);
|
servoTurnoutData.closedPosition, servoTurnoutData.profile, turnoutData->closed);
|
||||||
return tt;
|
return tt;
|
||||||
|
#else
|
||||||
|
(void)turnoutData;
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// For DCC++ classic compatibility, state reported to JMRI is 1 for thrown and 0 for closed
|
// For DCC++ classic compatibility, state reported to JMRI is 1 for thrown and 0 for closed
|
||||||
|
@ -308,6 +318,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServoTurnout::save() {
|
void ServoTurnout::save() {
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Write turnout definition and current position to EEPROM
|
// Write turnout definition and current position to EEPROM
|
||||||
// First write common servo data, then
|
// First write common servo data, then
|
||||||
// write the servo-specific data
|
// write the servo-specific data
|
||||||
|
@ -315,6 +326,7 @@
|
||||||
EEStore::advance(sizeof(_turnoutData));
|
EEStore::advance(sizeof(_turnoutData));
|
||||||
EEPROM.put(EEStore::pointer(), _servoTurnoutData);
|
EEPROM.put(EEStore::pointer(), _servoTurnoutData);
|
||||||
EEStore::advance(sizeof(_servoTurnoutData));
|
EEStore::advance(sizeof(_servoTurnoutData));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
@ -367,6 +379,7 @@
|
||||||
|
|
||||||
// Load a DCC turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
// Load a DCC turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
||||||
/* static */ Turnout *DCCTurnout::load(struct TurnoutData *turnoutData) {
|
/* static */ Turnout *DCCTurnout::load(struct TurnoutData *turnoutData) {
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
DCCTurnoutData dccTurnoutData;
|
DCCTurnoutData dccTurnoutData;
|
||||||
// Read class-specific data from EEPROM
|
// Read class-specific data from EEPROM
|
||||||
EEPROM.get(EEStore::pointer(), dccTurnoutData);
|
EEPROM.get(EEStore::pointer(), dccTurnoutData);
|
||||||
|
@ -376,6 +389,10 @@
|
||||||
DCCTurnout *tt = new DCCTurnout(turnoutData->id, dccTurnoutData.address, dccTurnoutData.subAddress);
|
DCCTurnout *tt = new DCCTurnout(turnoutData->id, dccTurnoutData.address, dccTurnoutData.subAddress);
|
||||||
|
|
||||||
return tt;
|
return tt;
|
||||||
|
#else
|
||||||
|
(void)turnoutData;
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCCTurnout::print(Print *stream) {
|
void DCCTurnout::print(Print *stream) {
|
||||||
|
@ -396,6 +413,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCCTurnout::save() {
|
void DCCTurnout::save() {
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Write turnout definition and current position to EEPROM
|
// Write turnout definition and current position to EEPROM
|
||||||
// First write common servo data, then
|
// First write common servo data, then
|
||||||
// write the servo-specific data
|
// write the servo-specific data
|
||||||
|
@ -403,6 +421,7 @@
|
||||||
EEStore::advance(sizeof(_turnoutData));
|
EEStore::advance(sizeof(_turnoutData));
|
||||||
EEPROM.put(EEStore::pointer(), _dccTurnoutData);
|
EEPROM.put(EEStore::pointer(), _dccTurnoutData);
|
||||||
EEStore::advance(sizeof(_dccTurnoutData));
|
EEStore::advance(sizeof(_dccTurnoutData));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -441,6 +460,7 @@
|
||||||
|
|
||||||
// Load a VPIN turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
// Load a VPIN turnout definition from EEPROM. The common Turnout data has already been read at this point.
|
||||||
/* static */ Turnout *VpinTurnout::load(struct TurnoutData *turnoutData) {
|
/* static */ Turnout *VpinTurnout::load(struct TurnoutData *turnoutData) {
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
VpinTurnoutData vpinTurnoutData;
|
VpinTurnoutData vpinTurnoutData;
|
||||||
// Read class-specific data from EEPROM
|
// Read class-specific data from EEPROM
|
||||||
EEPROM.get(EEStore::pointer(), vpinTurnoutData);
|
EEPROM.get(EEStore::pointer(), vpinTurnoutData);
|
||||||
|
@ -450,6 +470,10 @@
|
||||||
VpinTurnout *tt = new VpinTurnout(turnoutData->id, vpinTurnoutData.vpin, turnoutData->closed);
|
VpinTurnout *tt = new VpinTurnout(turnoutData->id, vpinTurnoutData.vpin, turnoutData->closed);
|
||||||
|
|
||||||
return tt;
|
return tt;
|
||||||
|
#else
|
||||||
|
(void)turnoutData;
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report 1 for thrown, 0 for closed.
|
// Report 1 for thrown, 0 for closed.
|
||||||
|
@ -465,6 +489,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
void VpinTurnout::save() {
|
void VpinTurnout::save() {
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Write turnout definition and current position to EEPROM
|
// Write turnout definition and current position to EEPROM
|
||||||
// First write common servo data, then
|
// First write common servo data, then
|
||||||
// write the servo-specific data
|
// write the servo-specific data
|
||||||
|
@ -472,6 +497,7 @@
|
||||||
EEStore::advance(sizeof(_turnoutData));
|
EEStore::advance(sizeof(_turnoutData));
|
||||||
EEPROM.put(EEStore::pointer(), _vpinTurnoutData);
|
EEPROM.put(EEStore::pointer(), _vpinTurnoutData);
|
||||||
EEStore::advance(sizeof(_vpinTurnoutData));
|
EEStore::advance(sizeof(_vpinTurnoutData));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -155,13 +155,14 @@ public:
|
||||||
|
|
||||||
inline static Turnout *first() { return _firstTurnout; }
|
inline static Turnout *first() { return _firstTurnout; }
|
||||||
|
|
||||||
|
#ifndef DISABLE_EEPROM
|
||||||
// Load all turnout definitions.
|
// Load all turnout definitions.
|
||||||
static void load();
|
static void load();
|
||||||
// Load one turnout definition
|
// Load one turnout definition
|
||||||
static Turnout *loadTurnout();
|
static Turnout *loadTurnout();
|
||||||
// Save all turnout definitions
|
// Save all turnout definitions
|
||||||
static void store();
|
static void store();
|
||||||
|
#endif
|
||||||
static void printAll(Print *stream) {
|
static void printAll(Print *stream) {
|
||||||
for (Turnout *tt = _firstTurnout; tt != 0; tt = tt->_nextTurnout)
|
for (Turnout *tt = _firstTurnout; tt != 0; tt = tt->_nextTurnout)
|
||||||
tt->printState(stream);
|
tt->printState(stream);
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
//
|
//
|
||||||
#define WIFI_SERIAL_LINK_SPEED 115200
|
#define WIFI_SERIAL_LINK_SPEED 115200
|
||||||
|
|
||||||
#if __has_include ( "myAutomation.h") && defined(BIG_RAM)
|
#if __has_include ( "myAutomation.h") && (defined(BIG_RAM) || defined(DISABLE_EEPROM))
|
||||||
#define RMFT_ACTIVE
|
#define RMFT_ACTIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user