From 170c9ab1ea6481d521b409e21033d592603ebbc6 Mon Sep 17 00:00:00 2001 From: David Cutting Date: Thu, 30 Jul 2020 18:27:04 -0600 Subject: [PATCH] Move to new commmanager scheme --- CommandStation-DCC.ino | 11 +++++++++-- Config.h | 10 +++++----- FreeMemory.h | 6 +++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CommandStation-DCC.ino b/CommandStation-DCC.ino index d19b97f..94ba85b 100644 --- a/CommandStation-DCC.ino +++ b/CommandStation-DCC.ino @@ -24,7 +24,11 @@ #include "Config.h" #include "FreeMemory.h" +#if defined(ARDUINO_ARCH_AVR) +int ramLowWatermark = 32767; +#else int ramLowWatermark = 256000; +#endif const uint8_t kIRQmicros = 29; const uint8_t kNumLocos = 50; @@ -83,14 +87,17 @@ void setup() { CommManager::registerInterface(new USBInterface(SerialUSB)); while(!SerialUSB) {} // Wait for USB to come online (remove once wifi is implemented) Wire.begin(); // Needed for EEPROM to work + EEStore::init(&SerialUSB); #elif defined (ARDUINO_ARCH_SAMC) CommManager::registerInterface(new SerialInterface(Serial)); Wire.begin(); // Needed for EEPROM to work + EEStore::init(&Serial); #elif defined(ARDUINO_ARCH_AVR) CommManager::registerInterface(new SerialInterface(Serial)); + EEStore::init(&Serial); #endif - EEStore::init(); + // Set up the string parser to accept commands from the interfaces DCCEXParser::init(mainTrack, progTrack); @@ -106,6 +113,6 @@ void loop() { int freeNow=freeMemory(); if (freeNow. */ -#ifndef COMMANDSTATION_DCC_CONFIG -#define COMMANDSTATION_DCC_CONFIG +#ifndef COMMANDSTATION_DCC_CONFIG_H_ +#define COMMANDSTATION_DCC_CONFIG_H_ // Choose the motor shield that you want to use. -#define CONFIG_WSM_FIREBOX_MK1 +//#define CONFIG_WSM_FIREBOX_MK1 //#define CONFIG_WSM_FIREBOX_MK1S -//#define CONFIG_ARDUINO_MOTOR_SHIELD +#define CONFIG_ARDUINO_MOTOR_SHIELD //#define CONFIG_POLOLU_MOTOR_SHIELD -#endif +#endif // COMMANDSTATION_DCC_CONFIG_H_ diff --git a/FreeMemory.h b/FreeMemory.h index ca1158c..25d3d65 100644 --- a/FreeMemory.h +++ b/FreeMemory.h @@ -1,5 +1,5 @@ -#ifndef freeMemory_h -#define freeMemory_h +#ifndef COMMANDSTATION_DCC_FREEMEMORY_H_ +#define COMMANDSTATION_DCC_FREEMEMORY_H_ // thanks go to https://github.com/mpflaga/Arduino-MemoryFree #ifdef __arm__ @@ -17,4 +17,4 @@ int freeMemory() { return __brkval ? &top - __brkval : &top - __malloc_heap_start; #endif // __arm__ } -#endif \ No newline at end of file +#endif // COMMANDSTATION_DCC_FREEMEMORY_H_ \ No newline at end of file