From ff7260b9bc7258a35df8b0ea4ed8f03a554f80cb Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Wed, 11 Jan 2023 17:36:11 +0000 Subject: [PATCH 1/7] Added code for FastClock Added code for both I2C fastclock and serial clocks --- CommandDistributor.cpp | 11 ++++ DCCEXParser.cpp | 22 ++++++- EXRAIL2.cpp | 12 +++- EXRAIL2.h | 4 ++ EXRAIL2MacroReset.h | 4 ++ EXRAILMacros.h | 10 +++ IO_EXFastclock.h | 134 +++++++++++++++++++++++++++++++++++++++++ myHal.cpp_example.txt | 15 ++++- 8 files changed, 209 insertions(+), 3 deletions(-) create mode 100644 IO_EXFastclock.h diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 9f2baa3..961df38 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -155,6 +155,17 @@ void CommandDistributor::broadcastTurnout(int16_t id, bool isClosed ) { #endif } +void CommandDistributor::broadcastClockTime(int16_t time, int8_t rate) { + // The JMRI clock command is of the form : PFT65871<;>4 + // The CS broadcast is of the form "\n"),time, rate); +#ifdef CD_HANDLE_RING + broadcastReply(WITHROTTLE_TYPE, F("PFT%d<;>%d\n"), time*60, rate); +#endif +} + void CommandDistributor::broadcastLoco(byte slot) { DCC::LOCO * sp=&DCC::speedTable[slot]; broadcastReply(COMMAND_TYPE, F("\n"), sp->loco,slot,sp->speedCode,sp->functions); diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index cbb152e..486ef32 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -97,6 +97,8 @@ Print *DCCEXParser::stashStream = NULL; RingStream *DCCEXParser::stashRingStream = NULL; byte DCCEXParser::stashTarget=0; +int16_t lastclocktime = 0; + // This is a JMRI command parser. // It doesnt know how the string got here, nor how it gets back. // It knows nothing about hardware or tracks... it just parses strings and @@ -570,9 +572,27 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) case 'J' : // throttle info access { - if ((params<1) | (params>2)) break; // + if ((params<1) | (params>3)) break; // int16_t id=(params==2)?p[1]:0; switch(p[0]) { + case HASH_KEYWORD_C: // sets time and speed + if (params==1) { // returns latest time + StringFormatter::send(stream, F("\n"), lastclocktime); + return; + } + if (p[1] != lastclocktime){ + if (Diag::CMD) { + DIAG(F("Clock Command Received")); + DIAG(F("Received Clock Time is: %d at rate: %d"), p[1], p[2]); + } + LCD(6,F("Clk Time:%d Sp %d"), p[1], p[2]); + //LCD(7,F("Clock Speed: %d"), p[2]); + RMFT2::clockEvent(p[1],1); + // Now tell everyone else what the time is. + CommandDistributor::broadcastClockTime(p[1], p[2]); + lastclocktime = p[1]; + } + return; case HASH_KEYWORD_A: // returns automations/routes StringFormatter::send(stream, F(" diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index f44f9dc..f969544 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -92,6 +92,7 @@ LookList * RMFT2::onRedLookup=NULL; LookList * RMFT2::onAmberLookup=NULL; LookList * RMFT2::onGreenLookup=NULL; LookList * RMFT2::onChangeLookup=NULL; +LookList * RMFT2::onClockLookup=NULL; #define GET_OPCODE GETHIGHFLASH(RMFT2::RouteCode,progCounter) #define SKIPOP progCounter+=3 @@ -175,6 +176,7 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) { onAmberLookup=LookListLoader(OPCODE_ONAMBER); onGreenLookup=LookListLoader(OPCODE_ONGREEN); onChangeLookup=LookListLoader(OPCODE_ONCHANGE); + onClockLookup=LookListLoader(OPCODE_ONTIME); // Second pass startup, define any turnouts or servos, set signals red // add sequences onRoutines to the lookups @@ -975,6 +977,7 @@ void RMFT2::loop2() { case OPCODE_ONAMBER: case OPCODE_ONGREEN: case OPCODE_ONCHANGE: + case OPCODE_ONTIME: break; @@ -1106,7 +1109,14 @@ void RMFT2::changeEvent(int16_t vpin, bool change) { // Hunt for an ONCHANGE for this sensor if (change) handleEvent(F("CHANGE"),onChangeLookup,vpin); } - + +void RMFT2::clockEvent(int16_t clocktime, bool change) { + // Hunt for an ONTIME for this time + if (Diag::CMD) + DIAG(F("Looking for clock event at : %d"), clocktime); + if (change) handleEvent(F("CHANGE"),onClockLookup,clocktime); +} + void RMFT2::handleEvent(const FSH* reason,LookList* handlers, int16_t id) { int pc= handlers->find(id); if (pc<0) return; diff --git a/EXRAIL2.h b/EXRAIL2.h index 2ea2ba1..69fd382 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -55,6 +55,8 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_SET_TRACK, OPCODE_ONRED,OPCODE_ONAMBER,OPCODE_ONGREEN, OPCODE_ONCHANGE, + OPCODE_ONCLOCKTIME, + OPCODE_ONTIME, // OPcodes below this point are skip-nesting IF operations // placed here so that they may be skipped as a group @@ -116,6 +118,7 @@ class LookList { static void turnoutEvent(int16_t id, bool closed); static void activateEvent(int16_t addr, bool active); static void changeEvent(int16_t id, bool change); + static void clockEvent(int16_t clocktime, bool change); static const int16_t SERVO_SIGNAL_FLAG=0x4000; static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000; static const int16_t DCC_SIGNAL_FLAG=0x1000; @@ -173,6 +176,7 @@ private: static LookList * onAmberLookup; static LookList * onGreenLookup; static LookList * onChangeLookup; + static LookList * onClockLookup; // Local variables - exist for each instance/task RMFT2 *next; // loop chain diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 32e28a2..a5e6d90 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -86,6 +86,8 @@ #undef ONDEACTIVATE #undef ONDEACTIVATEL #undef ONCLOSE +#undef ONTIME +#undef ONCLOCKTIME #undef ONGREEN #undef ONRED #undef ONTHROW @@ -198,6 +200,8 @@ #define ONACTIVATE(addr,subaddr) #define ONACTIVATEL(linear) #define ONAMBER(signal_id) +#define ONTIME(value) +#define ONCLOCKTIME(hours,mins) #define ONDEACTIVATE(addr,subaddr) #define ONDEACTIVATEL(linear) #define ONCLOSE(turnout_id) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index b5e78d9..7ef3acd 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -55,6 +55,14 @@ // helper macro for turnout description as HIDDEN #define HIDDEN "\x01" +// helper macro to strip leading zeros off time inputs +// (10#mins)%100) +#define STRIP_ZERO(value) 10##value%100 + +// helper macro to strip leading zeros off time inputs +// (10#mins)%100) +#define STRIP_ZERO(value) 10##value%100 + // Pass 1 Implements aliases #include "EXRAIL2MacroReset.h" #undef ALIAS @@ -297,6 +305,8 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = { #define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3), #define ONAMBER(signal_id) OPCODE_ONAMBER,V(signal_id), #define ONCLOSE(turnout_id) OPCODE_ONCLOSE,V(turnout_id), +#define ONTIME(value) OPCODE_ONTIME,V(value), +#define ONCLOCKTIME(hours,mins) OPCODE_ONTIME,V((STRIP_ZERO(hours)*60)+STRIP_ZERO(mins)), #define ONDEACTIVATE(addr,subaddr) OPCODE_ONDEACTIVATE,V(addr<<2|subaddr), #define ONDEACTIVATEL(linear) OPCODE_ONDEACTIVATE,V(linear+3), #define ONGREEN(signal_id) OPCODE_ONGREEN,V(signal_id), diff --git a/IO_EXFastclock.h b/IO_EXFastclock.h new file mode 100644 index 0000000..c9985f2 --- /dev/null +++ b/IO_EXFastclock.h @@ -0,0 +1,134 @@ +/* + * © 2022, Colin Murdoch. All rights reserved. + * + * This file is part of CommandStation-EX + * + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * It is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation. If not, see . +*/ + +/* +* The IO_EXFastclock device driver is used to interface the standalone fast clock and receive time data. +* +* The EX-fastClock code lives in a separate repo (https://github.com/DCC-EX/EX-Fastclock) and contains the clock logic. +* +* +*/ + +#ifndef IO_EXFastclock_h + #define IO_EXFastclock_h +#endif + +#include "IODevice.h" +#include "I2CManager.h" +#include "DIAG.h" +#include "EXRAIL2.h" +#include "CommandDistributor.h" + +bool FAST_CLOCK_EXISTS = true; + +class EXFastClock : public IODevice { +public: + // Constructor + EXFastClock(uint8_t I2CAddress){ + _I2CAddress = I2CAddress; + addDevice(this); + } + +static void EXFastClock::create(uint8_t _I2CAddress) { + + DIAG(F("Checking for Clock")); + // Start by assuming we will find the clock + // Check if specified I2C address is responding (blocking operation) + // Returns I2C_STATUS_OK (0) if OK, or error code. + uint8_t _checkforclock = I2CManager.checkAddress(_I2CAddress); + DIAG(F("Clock check result - %d"), _checkforclock); + if (_checkforclock == 0) { + FAST_CLOCK_EXISTS = true; + DIAG(F("I2C Fast Clock found at x%x"), _I2CAddress); + new EXFastClock(_I2CAddress); + } + else { + FAST_CLOCK_EXISTS = false; + DIAG(F("No Fast Clock found")); + LCD(6,F("CLOCK NOT FOUND")); + } + + } + +private: + //uint8_t _I2CAddress; + uint16_t _clocktime; + uint8_t _clockrate; + uint16_t _previousclocktime; + unsigned long _lastchecktime; + +// Initialisation of Fastclock +void _begin() override { + + if (FAST_CLOCK_EXISTS == true) { + I2CManager.begin(); + if (I2CManager.exists(_I2CAddress)) { + _deviceState = DEVSTATE_NORMAL; + #ifdef DIAG_IO + _display(); + #endif + } else { + _deviceState = DEVSTATE_FAILED; + LCD(6,F("CLOCK NOT FOUND")); + DIAG(F("Fast Clock Not Found at address %d"), _I2CAddress); + } + } +} + +// Processing loop to obtain clock time + +void _loop(unsigned long currentMicros) override{ + + if (FAST_CLOCK_EXISTS==true) { + uint8_t readBuffer[3]; + byte a,b; + #if defined(EXRAIL_ACTIVE) + I2CManager.read(_I2CAddress, readBuffer, 3); + a = readBuffer[0]; + b = readBuffer[1]; + _clocktime = (a << 8) + b; + _clockrate = readBuffer[2]; + + if (_clocktime != _previousclocktime) { + _previousclocktime = _clocktime; + if (Diag::CMD) + DIAG(F("Received Clock Time is: %d at rate: %d"), _clocktime, _clockrate); + LCD(6,F(("Clk Time:%d Sp %d")), _clocktime, _clockrate); + RMFT2::clockEvent(_clocktime,1); + // Now tell everyone else what the time is. + CommandDistributor::broadcastClockTime(_clocktime, _clockrate); + + // As the maximum clock increment is 2 seconds delay a bit - say 1 sec. + delayUntil(currentMicros + 1000000); // Wait 1000ms before checking again, + + } + _lastchecktime = currentMicros; + + #endif + + + } + +} + +// Display EX-FastClock device driver info. +void _display() { + DIAG(F("FastCLock on I2C:x%x - %S"), _I2CAddress, (_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F("")); +} +}; diff --git a/myHal.cpp_example.txt b/myHal.cpp_example.txt index 5470f76..64adac1 100644 --- a/myHal.cpp_example.txt +++ b/myHal.cpp_example.txt @@ -21,7 +21,7 @@ #include "IO_VL53L0X.h" // Laser time-of-flight sensor #include "IO_DFPlayer.h" // MP3 sound player //#include "IO_EXTurntable.h" // Turntable-EX turntable controller - +//#include "IO_EXFastClock.h" // FastClock driver //========================================================================== // The function halSetup() is invoked from CS if it exists within the build. @@ -206,6 +206,19 @@ void halSetup() { //RotaryEncoder::create(700, 1, 0x70); //RotaryEncoder::create(701, 2, 0x71); + //======================================================================= + // The following directive defines an EX-FastClock instance. + //======================================================================= + // EXFastCLock::create(I2C Address) + // + // The parameters are: + // + // I2C address=0x55 (decimal 85) + // + // Note that the I2C address is defined in the EX-FastClock code, and 0x55 is the default. + + + // EXFastClock::create(0x55); } From 873d470f867f81a25cc9e85c6b5545beecaceeb5 Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Wed, 11 Jan 2023 19:50:39 +0000 Subject: [PATCH 2/7] Supply missing function Supply missing function --- CommandDistributor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/CommandDistributor.h b/CommandDistributor.h index 633ff77..c816b94 100644 --- a/CommandDistributor.h +++ b/CommandDistributor.h @@ -45,6 +45,7 @@ public : static void broadcastLoco(byte slot); static void broadcastSensor(int16_t id, bool value); static void broadcastTurnout(int16_t id, bool isClosed); + static void broadcastClockTime(int16_t time, int8_t rate); static void broadcastPower(); static void broadcastText(const FSH * msg); template static void broadcastReply(clientType type, Targs... msg); From 8fac20a4518515a37c55d0d9542422445a2a9568 Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Mon, 16 Jan 2023 18:16:25 +0000 Subject: [PATCH 3/7] Add #ifdef selections Add #ifdef selections linked to #define in config.exampe.h --- CommandDistributor.cpp | 2 ++ CommandDistributor.h | 2 ++ DCCEXParser.cpp | 9 +++++++++ EXRAIL2.cpp | 10 +++++++++- EXRAIL2.h | 6 ++++++ EXRAIL2MacroReset.h | 4 ++++ EXRAILMacros.h | 8 ++++---- IO_EXFastclock.h | 16 +++++++++------- config.example.h | 4 ++++ 9 files changed, 49 insertions(+), 12 deletions(-) diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 961df38..3fe1e96 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -155,6 +155,7 @@ void CommandDistributor::broadcastTurnout(int16_t id, bool isClosed ) { #endif } +#ifdef USEFASTCLOCK void CommandDistributor::broadcastClockTime(int16_t time, int8_t rate) { // The JMRI clock command is of the form : PFT65871<;>4 // The CS broadcast is of the form "%d\n"), time*60, rate); #endif } +#endif void CommandDistributor::broadcastLoco(byte slot) { DCC::LOCO * sp=&DCC::speedTable[slot]; diff --git a/CommandDistributor.h b/CommandDistributor.h index c816b94..d51b2b6 100644 --- a/CommandDistributor.h +++ b/CommandDistributor.h @@ -45,7 +45,9 @@ public : static void broadcastLoco(byte slot); static void broadcastSensor(int16_t id, bool value); static void broadcastTurnout(int16_t id, bool isClosed); +#ifdef USEFASTCLOCK static void broadcastClockTime(int16_t time, int8_t rate); +#ifdef static void broadcastPower(); static void broadcastText(const FSH * msg); template static void broadcastReply(clientType type, Targs... msg); diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 486ef32..3898f95 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -97,7 +97,9 @@ Print *DCCEXParser::stashStream = NULL; RingStream *DCCEXParser::stashRingStream = NULL; byte DCCEXParser::stashTarget=0; +#ifdef USEFASTCLOCK int16_t lastclocktime = 0; +#endif // This is a JMRI command parser. // It doesnt know how the string got here, nor how it gets back. @@ -572,9 +574,15 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) case 'J' : // throttle info access { +#ifdef USEFASTCLOCK if ((params<1) | (params>3)) break; // +#endif +#ifndef USEFASTCLOCK + if ((params<1) | (params>2)) break; // +#endif int16_t id=(params==2)?p[1]:0; switch(p[0]) { +#ifdef USEFASTCLOCK case HASH_KEYWORD_C: // sets time and speed if (params==1) { // returns latest time StringFormatter::send(stream, F("\n"), lastclocktime); @@ -593,6 +601,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) lastclocktime = p[1]; } return; +#endif case HASH_KEYWORD_A: // returns automations/routes StringFormatter::send(stream, F(" diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index f969544..1b5b51e 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -92,7 +92,9 @@ LookList * RMFT2::onRedLookup=NULL; LookList * RMFT2::onAmberLookup=NULL; LookList * RMFT2::onGreenLookup=NULL; LookList * RMFT2::onChangeLookup=NULL; +#ifdef USEFASTCLOCK LookList * RMFT2::onClockLookup=NULL; +#endif #define GET_OPCODE GETHIGHFLASH(RMFT2::RouteCode,progCounter) #define SKIPOP progCounter+=3 @@ -176,7 +178,9 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) { onAmberLookup=LookListLoader(OPCODE_ONAMBER); onGreenLookup=LookListLoader(OPCODE_ONGREEN); onChangeLookup=LookListLoader(OPCODE_ONCHANGE); + #ifdef USEFASTCLOCK onClockLookup=LookListLoader(OPCODE_ONTIME); + #endif // Second pass startup, define any turnouts or servos, set signals red // add sequences onRoutines to the lookups @@ -977,7 +981,9 @@ void RMFT2::loop2() { case OPCODE_ONAMBER: case OPCODE_ONGREEN: case OPCODE_ONCHANGE: + #ifdef USEFASTCLOCK case OPCODE_ONTIME: + #endif break; @@ -1110,12 +1116,14 @@ void RMFT2::changeEvent(int16_t vpin, bool change) { if (change) handleEvent(F("CHANGE"),onChangeLookup,vpin); } +#ifdef USEFASTCLOCK void RMFT2::clockEvent(int16_t clocktime, bool change) { // Hunt for an ONTIME for this time if (Diag::CMD) DIAG(F("Looking for clock event at : %d"), clocktime); - if (change) handleEvent(F("CHANGE"),onClockLookup,clocktime); + if (change) handleEvent(F("CLOCK"),onClockLookup,clocktime); } +#endif void RMFT2::handleEvent(const FSH* reason,LookList* handlers, int16_t id) { int pc= handlers->find(id); diff --git a/EXRAIL2.h b/EXRAIL2.h index 69fd382..7f04458 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -55,8 +55,10 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_SET_TRACK, OPCODE_ONRED,OPCODE_ONAMBER,OPCODE_ONGREEN, OPCODE_ONCHANGE, +#ifdef USEFASTCLOCK OPCODE_ONCLOCKTIME, OPCODE_ONTIME, +#endif // OPcodes below this point are skip-nesting IF operations // placed here so that they may be skipped as a group @@ -118,7 +120,9 @@ class LookList { static void turnoutEvent(int16_t id, bool closed); static void activateEvent(int16_t addr, bool active); static void changeEvent(int16_t id, bool change); + #ifdef USEFASTCLOCK static void clockEvent(int16_t clocktime, bool change); + #endif static const int16_t SERVO_SIGNAL_FLAG=0x4000; static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000; static const int16_t DCC_SIGNAL_FLAG=0x1000; @@ -176,7 +180,9 @@ private: static LookList * onAmberLookup; static LookList * onGreenLookup; static LookList * onChangeLookup; +#ifdef USEFASTCLOCK static LookList * onClockLookup; +#endif // Local variables - exist for each instance/task RMFT2 *next; // loop chain diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index a5e6d90..409cdcd 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -86,8 +86,10 @@ #undef ONDEACTIVATE #undef ONDEACTIVATEL #undef ONCLOSE +#ifdef USEFASTCLOCK #undef ONTIME #undef ONCLOCKTIME +#endif #undef ONGREEN #undef ONRED #undef ONTHROW @@ -200,8 +202,10 @@ #define ONACTIVATE(addr,subaddr) #define ONACTIVATEL(linear) #define ONAMBER(signal_id) +#ifdef USEFASTCLOCK #define ONTIME(value) #define ONCLOCKTIME(hours,mins) +#endif #define ONDEACTIVATE(addr,subaddr) #define ONDEACTIVATEL(linear) #define ONCLOSE(turnout_id) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 7ef3acd..0d807d1 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -55,13 +55,11 @@ // helper macro for turnout description as HIDDEN #define HIDDEN "\x01" +#ifdef USEFASTCLOCK // helper macro to strip leading zeros off time inputs // (10#mins)%100) #define STRIP_ZERO(value) 10##value%100 - -// helper macro to strip leading zeros off time inputs -// (10#mins)%100) -#define STRIP_ZERO(value) 10##value%100 +#endif // Pass 1 Implements aliases #include "EXRAIL2MacroReset.h" @@ -305,8 +303,10 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = { #define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3), #define ONAMBER(signal_id) OPCODE_ONAMBER,V(signal_id), #define ONCLOSE(turnout_id) OPCODE_ONCLOSE,V(turnout_id), +#ifdef USEFASTCLOCK #define ONTIME(value) OPCODE_ONTIME,V(value), #define ONCLOCKTIME(hours,mins) OPCODE_ONTIME,V((STRIP_ZERO(hours)*60)+STRIP_ZERO(mins)), +#endif #define ONDEACTIVATE(addr,subaddr) OPCODE_ONDEACTIVATE,V(addr<<2|subaddr), #define ONDEACTIVATEL(linear) OPCODE_ONDEACTIVATE,V(linear+3), #define ONGREEN(signal_id) OPCODE_ONGREEN,V(signal_id), diff --git a/IO_EXFastclock.h b/IO_EXFastclock.h index c9985f2..22bb94e 100644 --- a/IO_EXFastclock.h +++ b/IO_EXFastclock.h @@ -26,8 +26,8 @@ */ #ifndef IO_EXFastclock_h - #define IO_EXFastclock_h -#endif +#define IO_EXFastclock_h + #include "IODevice.h" #include "I2CManager.h" @@ -55,12 +55,12 @@ static void EXFastClock::create(uint8_t _I2CAddress) { DIAG(F("Clock check result - %d"), _checkforclock); if (_checkforclock == 0) { FAST_CLOCK_EXISTS = true; - DIAG(F("I2C Fast Clock found at x%x"), _I2CAddress); + //DIAG(F("I2C Fast Clock found at x%x"), _I2CAddress); new EXFastClock(_I2CAddress); } else { FAST_CLOCK_EXISTS = false; - DIAG(F("No Fast Clock found")); + //DIAG(F("No Fast Clock found")); LCD(6,F("CLOCK NOT FOUND")); } @@ -85,7 +85,7 @@ void _begin() override { #endif } else { _deviceState = DEVSTATE_FAILED; - LCD(6,F("CLOCK NOT FOUND")); + //LCD(6,F("CLOCK NOT FOUND")); DIAG(F("Fast Clock Not Found at address %d"), _I2CAddress); } } @@ -107,8 +107,8 @@ void _loop(unsigned long currentMicros) override{ if (_clocktime != _previousclocktime) { _previousclocktime = _clocktime; - if (Diag::CMD) - DIAG(F("Received Clock Time is: %d at rate: %d"), _clocktime, _clockrate); + //if (Diag::CMD) + // DIAG(F("Received Clock Time is: %d at rate: %d"), _clocktime, _clockrate); LCD(6,F(("Clk Time:%d Sp %d")), _clocktime, _clockrate); RMFT2::clockEvent(_clocktime,1); // Now tell everyone else what the time is. @@ -132,3 +132,5 @@ void _display() { DIAG(F("FastCLock on I2C:x%x - %S"), _I2CAddress, (_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F("")); } }; + +#endif diff --git a/config.example.h b/config.example.h index aae18a9..a2d97c5 100644 --- a/config.example.h +++ b/config.example.h @@ -224,4 +224,8 @@ The configuration file for DCC-EX Command Station // //#define SERIAL_BT_COMMANDS + +// FastClock Enabler +// To build the FastClock code into the CS please uncomment the line below +//#define USEFASTCLOCK ///////////////////////////////////////////////////////////////////////////////////// From b62c4da04da63b25b561abfe94756cd51d6977e7 Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Tue, 17 Jan 2023 10:56:12 +0000 Subject: [PATCH 4/7] Update CommandDistributor.h Fixed #endif typo. --- CommandDistributor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommandDistributor.h b/CommandDistributor.h index d51b2b6..3df477c 100644 --- a/CommandDistributor.h +++ b/CommandDistributor.h @@ -47,7 +47,7 @@ public : static void broadcastTurnout(int16_t id, bool isClosed); #ifdef USEFASTCLOCK static void broadcastClockTime(int16_t time, int8_t rate); -#ifdef +#endif static void broadcastPower(); static void broadcastText(const FSH * msg); template static void broadcastReply(clientType type, Targs... msg); From cd46d3c9e07a4641843a154046cc7482504932fe Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Sat, 21 Jan 2023 10:18:54 +0000 Subject: [PATCH 5/7] Remove #ifdef and merge calcs Remove #idfef statements and merge duplicate routines into CommandDistributor --- CommandDistributor.cpp | 40 +++++++++++++++++++++++++++++++-- CommandDistributor.h | 6 +++-- DCCEXParser.cpp | 29 +++++------------------- EXRAIL2.cpp | 9 +------- EXRAIL2.h | 6 ----- EXRAIL2MacroReset.h | 4 ---- EXRAILMacros.h | 4 ---- IO_EXFastclock.h | 50 ++++++++++++++++++------------------------ 8 files changed, 69 insertions(+), 79 deletions(-) diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 3fe1e96..652d852 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -29,6 +29,11 @@ #include "DCCWaveform.h" #include "DCC.h" #include "TrackManager.h" +#include "StringFormatter.h" + +// variables to hold clock time +int16_t lastclocktime; +int8_t lastclockrate; #if WIFI_ON || ETHERNET_ON || defined(SERIAL1_COMMANDS) || defined(SERIAL2_COMMANDS) || defined(SERIAL3_COMMANDS) @@ -155,7 +160,6 @@ void CommandDistributor::broadcastTurnout(int16_t id, bool isClosed ) { #endif } -#ifdef USEFASTCLOCK void CommandDistributor::broadcastClockTime(int16_t time, int8_t rate) { // The JMRI clock command is of the form : PFT65871<;>4 // The CS broadcast is of the form "%d\n"), time*60, rate); #endif } -#endif + +void CommandDistributor::setClockTime(int16_t clocktime, int8_t clockrate, byte opt) { + // opt - case 1 save the latest time if changed + // case 2 broadcast the time when requested + // case 3 display latest time + switch (opt) + { + case 1: + if (clocktime != lastclocktime){ + if (Diag::CMD) { + DIAG(F("Clock Command Received")); + DIAG(F("Received Clock Time is: %d at rate: %d"), clocktime, clockrate); + } + LCD(6,F("Clk Time:%d Sp %d"), clocktime, clockrate); + // look for an event for this time + RMFT2::clockEvent(clocktime,1); + // Now tell everyone else what the time is. + CommandDistributor::broadcastClockTime(clocktime, clockrate); + lastclocktime = clocktime; + lastclockrate = clockrate; + } + return; + + case 2: + CommandDistributor::broadcastClockTime(lastclocktime, lastclockrate); + return; + } + +} + +int16_t CommandDistributor::retClockTime() { + return lastclocktime; +} void CommandDistributor::broadcastLoco(byte slot) { DCC::LOCO * sp=&DCC::speedTable[slot]; diff --git a/CommandDistributor.h b/CommandDistributor.h index 3df477c..bbbc44c 100644 --- a/CommandDistributor.h +++ b/CommandDistributor.h @@ -25,6 +25,7 @@ #include "RingStream.h" #include "StringBuffer.h" #include "defines.h" +#include "EXRAIL2.h" #if WIFI_ON | ETHERNET_ON // Command Distributor must handle a RingStream of clients @@ -45,13 +46,14 @@ public : static void broadcastLoco(byte slot); static void broadcastSensor(int16_t id, bool value); static void broadcastTurnout(int16_t id, bool isClosed); -#ifdef USEFASTCLOCK static void broadcastClockTime(int16_t time, int8_t rate); -#endif + static void setClockTime(int16_t time, int8_t rate, byte opt); + static int16_t retClockTime(); static void broadcastPower(); static void broadcastText(const FSH * msg); template static void broadcastReply(clientType type, Targs... msg); static void forget(byte clientId); + }; #endif diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 3898f95..5c0cb84 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -97,10 +97,6 @@ Print *DCCEXParser::stashStream = NULL; RingStream *DCCEXParser::stashRingStream = NULL; byte DCCEXParser::stashTarget=0; -#ifdef USEFASTCLOCK -int16_t lastclocktime = 0; -#endif - // This is a JMRI command parser. // It doesnt know how the string got here, nor how it gets back. // It knows nothing about hardware or tracks... it just parses strings and @@ -574,34 +570,19 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) case 'J' : // throttle info access { -#ifdef USEFASTCLOCK if ((params<1) | (params>3)) break; // -#endif -#ifndef USEFASTCLOCK - if ((params<1) | (params>2)) break; // -#endif + //if ((params<1) | (params>2)) break; // int16_t id=(params==2)?p[1]:0; switch(p[0]) { -#ifdef USEFASTCLOCK case HASH_KEYWORD_C: // sets time and speed if (params==1) { // returns latest time - StringFormatter::send(stream, F("\n"), lastclocktime); + int16_t x = CommandDistributor::retClockTime(); + StringFormatter::send(stream, F("\n"), x); return; } - if (p[1] != lastclocktime){ - if (Diag::CMD) { - DIAG(F("Clock Command Received")); - DIAG(F("Received Clock Time is: %d at rate: %d"), p[1], p[2]); - } - LCD(6,F("Clk Time:%d Sp %d"), p[1], p[2]); - //LCD(7,F("Clock Speed: %d"), p[2]); - RMFT2::clockEvent(p[1],1); - // Now tell everyone else what the time is. - CommandDistributor::broadcastClockTime(p[1], p[2]); - lastclocktime = p[1]; - } + CommandDistributor::setClockTime(p[1], p[2], 1); return; -#endif + case HASH_KEYWORD_A: // returns automations/routes StringFormatter::send(stream, F(" diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 1b5b51e..75ec63b 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -92,9 +92,7 @@ LookList * RMFT2::onRedLookup=NULL; LookList * RMFT2::onAmberLookup=NULL; LookList * RMFT2::onGreenLookup=NULL; LookList * RMFT2::onChangeLookup=NULL; -#ifdef USEFASTCLOCK LookList * RMFT2::onClockLookup=NULL; -#endif #define GET_OPCODE GETHIGHFLASH(RMFT2::RouteCode,progCounter) #define SKIPOP progCounter+=3 @@ -178,9 +176,8 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) { onAmberLookup=LookListLoader(OPCODE_ONAMBER); onGreenLookup=LookListLoader(OPCODE_ONGREEN); onChangeLookup=LookListLoader(OPCODE_ONCHANGE); - #ifdef USEFASTCLOCK onClockLookup=LookListLoader(OPCODE_ONTIME); - #endif + // Second pass startup, define any turnouts or servos, set signals red // add sequences onRoutines to the lookups @@ -981,9 +978,7 @@ void RMFT2::loop2() { case OPCODE_ONAMBER: case OPCODE_ONGREEN: case OPCODE_ONCHANGE: - #ifdef USEFASTCLOCK case OPCODE_ONTIME: - #endif break; @@ -1116,14 +1111,12 @@ void RMFT2::changeEvent(int16_t vpin, bool change) { if (change) handleEvent(F("CHANGE"),onChangeLookup,vpin); } -#ifdef USEFASTCLOCK void RMFT2::clockEvent(int16_t clocktime, bool change) { // Hunt for an ONTIME for this time if (Diag::CMD) DIAG(F("Looking for clock event at : %d"), clocktime); if (change) handleEvent(F("CLOCK"),onClockLookup,clocktime); } -#endif void RMFT2::handleEvent(const FSH* reason,LookList* handlers, int16_t id) { int pc= handlers->find(id); diff --git a/EXRAIL2.h b/EXRAIL2.h index 7f04458..69fd382 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -55,10 +55,8 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_SET_TRACK, OPCODE_ONRED,OPCODE_ONAMBER,OPCODE_ONGREEN, OPCODE_ONCHANGE, -#ifdef USEFASTCLOCK OPCODE_ONCLOCKTIME, OPCODE_ONTIME, -#endif // OPcodes below this point are skip-nesting IF operations // placed here so that they may be skipped as a group @@ -120,9 +118,7 @@ class LookList { static void turnoutEvent(int16_t id, bool closed); static void activateEvent(int16_t addr, bool active); static void changeEvent(int16_t id, bool change); - #ifdef USEFASTCLOCK static void clockEvent(int16_t clocktime, bool change); - #endif static const int16_t SERVO_SIGNAL_FLAG=0x4000; static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000; static const int16_t DCC_SIGNAL_FLAG=0x1000; @@ -180,9 +176,7 @@ private: static LookList * onAmberLookup; static LookList * onGreenLookup; static LookList * onChangeLookup; -#ifdef USEFASTCLOCK static LookList * onClockLookup; -#endif // Local variables - exist for each instance/task RMFT2 *next; // loop chain diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 409cdcd..a5e6d90 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -86,10 +86,8 @@ #undef ONDEACTIVATE #undef ONDEACTIVATEL #undef ONCLOSE -#ifdef USEFASTCLOCK #undef ONTIME #undef ONCLOCKTIME -#endif #undef ONGREEN #undef ONRED #undef ONTHROW @@ -202,10 +200,8 @@ #define ONACTIVATE(addr,subaddr) #define ONACTIVATEL(linear) #define ONAMBER(signal_id) -#ifdef USEFASTCLOCK #define ONTIME(value) #define ONCLOCKTIME(hours,mins) -#endif #define ONDEACTIVATE(addr,subaddr) #define ONDEACTIVATEL(linear) #define ONCLOSE(turnout_id) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 0d807d1..2ffbc75 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -55,11 +55,9 @@ // helper macro for turnout description as HIDDEN #define HIDDEN "\x01" -#ifdef USEFASTCLOCK // helper macro to strip leading zeros off time inputs // (10#mins)%100) #define STRIP_ZERO(value) 10##value%100 -#endif // Pass 1 Implements aliases #include "EXRAIL2MacroReset.h" @@ -303,10 +301,8 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = { #define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3), #define ONAMBER(signal_id) OPCODE_ONAMBER,V(signal_id), #define ONCLOSE(turnout_id) OPCODE_ONCLOSE,V(turnout_id), -#ifdef USEFASTCLOCK #define ONTIME(value) OPCODE_ONTIME,V(value), #define ONCLOCKTIME(hours,mins) OPCODE_ONTIME,V((STRIP_ZERO(hours)*60)+STRIP_ZERO(mins)), -#endif #define ONDEACTIVATE(addr,subaddr) OPCODE_ONDEACTIVATE,V(addr<<2|subaddr), #define ONDEACTIVATEL(linear) OPCODE_ONDEACTIVATE,V(linear+3), #define ONGREEN(signal_id) OPCODE_ONGREEN,V(signal_id), diff --git a/IO_EXFastclock.h b/IO_EXFastclock.h index 22bb94e..0e1bf76 100644 --- a/IO_EXFastclock.h +++ b/IO_EXFastclock.h @@ -45,7 +45,7 @@ public: addDevice(this); } -static void EXFastClock::create(uint8_t _I2CAddress) { +static void create(uint8_t _I2CAddress) { DIAG(F("Checking for Clock")); // Start by assuming we will find the clock @@ -53,6 +53,7 @@ static void EXFastClock::create(uint8_t _I2CAddress) { // Returns I2C_STATUS_OK (0) if OK, or error code. uint8_t _checkforclock = I2CManager.checkAddress(_I2CAddress); DIAG(F("Clock check result - %d"), _checkforclock); + // XXXX change thistosave2 bytes if (_checkforclock == 0) { FAST_CLOCK_EXISTS = true; //DIAG(F("I2C Fast Clock found at x%x"), _I2CAddress); @@ -67,11 +68,8 @@ static void EXFastClock::create(uint8_t _I2CAddress) { } private: - //uint8_t _I2CAddress; - uint16_t _clocktime; - uint8_t _clockrate; - uint16_t _previousclocktime; - unsigned long _lastchecktime; +uint8_t _I2CAddress; + // Initialisation of Fastclock void _begin() override { @@ -98,39 +96,33 @@ void _loop(unsigned long currentMicros) override{ if (FAST_CLOCK_EXISTS==true) { uint8_t readBuffer[3]; byte a,b; - #if defined(EXRAIL_ACTIVE) + #ifdef EXRAIL_ACTIVE I2CManager.read(_I2CAddress, readBuffer, 3); + // XXXX change this to save a few bytes a = readBuffer[0]; b = readBuffer[1]; - _clocktime = (a << 8) + b; - _clockrate = readBuffer[2]; + //_clocktime = (a << 8) + b; + //_clockrate = readBuffer[2]; - if (_clocktime != _previousclocktime) { - _previousclocktime = _clocktime; - //if (Diag::CMD) - // DIAG(F("Received Clock Time is: %d at rate: %d"), _clocktime, _clockrate); - LCD(6,F(("Clk Time:%d Sp %d")), _clocktime, _clockrate); - RMFT2::clockEvent(_clocktime,1); - // Now tell everyone else what the time is. - CommandDistributor::broadcastClockTime(_clocktime, _clockrate); - - // As the maximum clock increment is 2 seconds delay a bit - say 1 sec. - delayUntil(currentMicros + 1000000); // Wait 1000ms before checking again, + CommandDistributor::setClockTime(((a << 8) + b), readBuffer[2], 1); + //setClockTime(int16_t clocktime, int8_t clockrate, byte opt); + + // As the minimum clock increment is 2 seconds delay a bit - say 1 sec. + // Clock interval is 60/ clockspeed i.e 60/b seconds + delayUntil(currentMicros + ((60/b) * 1000000)); } - _lastchecktime = currentMicros; - + #endif - } - -} -// Display EX-FastClock device driver info. -void _display() { - DIAG(F("FastCLock on I2C:x%x - %S"), _I2CAddress, (_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F("")); -} + + // Display EX-FastClock device driver info. + void _display() { + DIAG(F("FastCLock on I2C:x%x - %S"), _I2CAddress, (_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F("")); + } + }; #endif From 286bdc3c4d817ed0a75c8021955b804ca15aa44b Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Sat, 21 Jan 2023 10:20:49 +0000 Subject: [PATCH 6/7] Create platformio.ini.original --- platformio.ini.original | 223 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 platformio.ini.original diff --git a/platformio.ini.original b/platformio.ini.original new file mode 100644 index 0000000..82167f2 --- /dev/null +++ b/platformio.ini.original @@ -0,0 +1,223 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[platformio] +default_envs = + mega2560 + uno + mega328 + unowifiR2 + nano + samd21-dev-usb + samd21-zero-usb + ESP32 + Nucleo-F411RE + Nucleo-F446RE + Teensy3.2 + Teensy3.5 + Teensy3.6 + Teensy4.0 + Teensy4.1 +src_dir = . +include_dir = . + +[env] +build_flags = -Wall -Wextra + +[env:samd21-dev-usb] +platform = atmelsam +board = sparkfun_samd21_dev_usb +framework = arduino +upload_protocol = sam-ba +lib_deps = ${env.lib_deps} +monitor_speed = 115200 +monitor_echo = yes +build_flags = -std=c++17 + +[env:samd21-zero-usb] +platform = atmelsam +board = zeroUSB +framework = arduino +upload_protocol = sam-ba +lib_deps = ${env.lib_deps} +monitor_speed = 115200 +monitor_echo = yes +build_flags = -std=c++17 + +[env:mega2560-debug] +platform = atmelavr +board = megaatmega2560 +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +build_flags = -DDIAG_IO -DDIAG_LOOPTIMES + +[env:mega2560-no-HAL] +platform = atmelavr +board = megaatmega2560 +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +build_flags = -DIO_NO_HAL + +[env:mega2560-I2C-wire] +platform = atmelavr +board = megaatmega2560 +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +build_flags = -DI2C_USE_WIRE + +[env:mega2560] +platform = atmelavr +board = megaatmega2560 +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +build_flags = -mcall-prologues + +[env:mega328] +platform = atmelavr +board = uno +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes + +[env:unowifiR2] +platform = atmelmegaavr +board = uno_wifi_rev2 +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +build_flags = "-DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO_WIFI_DEV_ED -DARDUINO_ARCH_AVR -DESP_CH_UART -DESP_CH_UART_BR=19200" + +[env:nanoevery] +platform = atmelmegaavr +board = nano_every +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +upload_speed = 19200 +build_flags = -DDIAG_IO + +[env:uno] +platform = atmelavr +board = uno +framework = arduino +lib_deps = + ${env.lib_deps} + arduino-libraries/Ethernet + SPI +monitor_speed = 115200 +monitor_echo = yes +build_flags = -mcall-prologues + +[env:nano] +platform = atmelavr +board = nanoatmega328new +board_upload.maximum_size = 32256 +framework = arduino +lib_deps = ${env.lib_deps} +monitor_speed = 115200 +monitor_echo = yes + +[env:ESP32] +platform = espressif32 +board = esp32dev +framework = arduino +lib_deps = ${env.lib_deps} +build_flags = -std=c++17 + +[env:Nucleo-F411RE] +platform = ststm32 +board = nucleo_f411re +framework = arduino +lib_deps = ${env.lib_deps} +build_flags = -std=c++17 -Os -g2 -Wunused-variable +monitor_speed = 115200 +monitor_echo = yes + +[env:Nucleo-F446RE] +platform = ststm32 +board = nucleo_f446re +framework = arduino +lib_deps = ${env.lib_deps} +build_flags = -std=c++17 -Os -g2 -Wunused-variable +monitor_speed = 115200 +monitor_echo = yes + +[env:Teensy3.2] +platform = teensy +board = teensy31 +framework = arduino +build_flags = -std=c++17 -Os -g2 +lib_deps = ${env.lib_deps} +lib_ignore = NativeEthernet + +[env:Teensy3.5] +platform = teensy +board = teensy35 +framework = arduino +build_flags = -std=c++17 -Os -g2 +lib_deps = ${env.lib_deps} +lib_ignore = NativeEthernet + +[env:Teensy3.6] +platform = teensy +board = teensy36 +framework = arduino +build_flags = -std=c++17 -Os -g2 +lib_deps = ${env.lib_deps} +lib_ignore = NativeEthernet + +[env:Teensy4.0] +platform = teensy +board = teensy40 +framework = arduino +build_flags = -std=c++17 -Os -g2 +lib_deps = ${env.lib_deps} +lib_ignore = NativeEthernet + +[env:Teensy4.1] +platform = teensy +board = teensy41 +framework = arduino +build_flags = -std=c++17 -Os -g2 +lib_deps = ${env.lib_deps} +lib_ignore = + From 006c85e6ae60dc9c89502dc4a3cb1af8b82cf483 Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Tue, 24 Jan 2023 12:21:28 +0000 Subject: [PATCH 7/7] Delete platformio.ini.original Delete file not required --- platformio.ini.original | 223 ---------------------------------------- 1 file changed, 223 deletions(-) delete mode 100644 platformio.ini.original diff --git a/platformio.ini.original b/platformio.ini.original deleted file mode 100644 index 82167f2..0000000 --- a/platformio.ini.original +++ /dev/null @@ -1,223 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[platformio] -default_envs = - mega2560 - uno - mega328 - unowifiR2 - nano - samd21-dev-usb - samd21-zero-usb - ESP32 - Nucleo-F411RE - Nucleo-F446RE - Teensy3.2 - Teensy3.5 - Teensy3.6 - Teensy4.0 - Teensy4.1 -src_dir = . -include_dir = . - -[env] -build_flags = -Wall -Wextra - -[env:samd21-dev-usb] -platform = atmelsam -board = sparkfun_samd21_dev_usb -framework = arduino -upload_protocol = sam-ba -lib_deps = ${env.lib_deps} -monitor_speed = 115200 -monitor_echo = yes -build_flags = -std=c++17 - -[env:samd21-zero-usb] -platform = atmelsam -board = zeroUSB -framework = arduino -upload_protocol = sam-ba -lib_deps = ${env.lib_deps} -monitor_speed = 115200 -monitor_echo = yes -build_flags = -std=c++17 - -[env:mega2560-debug] -platform = atmelavr -board = megaatmega2560 -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -build_flags = -DDIAG_IO -DDIAG_LOOPTIMES - -[env:mega2560-no-HAL] -platform = atmelavr -board = megaatmega2560 -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -build_flags = -DIO_NO_HAL - -[env:mega2560-I2C-wire] -platform = atmelavr -board = megaatmega2560 -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -build_flags = -DI2C_USE_WIRE - -[env:mega2560] -platform = atmelavr -board = megaatmega2560 -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -build_flags = -mcall-prologues - -[env:mega328] -platform = atmelavr -board = uno -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes - -[env:unowifiR2] -platform = atmelmegaavr -board = uno_wifi_rev2 -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -build_flags = "-DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO_WIFI_DEV_ED -DARDUINO_ARCH_AVR -DESP_CH_UART -DESP_CH_UART_BR=19200" - -[env:nanoevery] -platform = atmelmegaavr -board = nano_every -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -upload_speed = 19200 -build_flags = -DDIAG_IO - -[env:uno] -platform = atmelavr -board = uno -framework = arduino -lib_deps = - ${env.lib_deps} - arduino-libraries/Ethernet - SPI -monitor_speed = 115200 -monitor_echo = yes -build_flags = -mcall-prologues - -[env:nano] -platform = atmelavr -board = nanoatmega328new -board_upload.maximum_size = 32256 -framework = arduino -lib_deps = ${env.lib_deps} -monitor_speed = 115200 -monitor_echo = yes - -[env:ESP32] -platform = espressif32 -board = esp32dev -framework = arduino -lib_deps = ${env.lib_deps} -build_flags = -std=c++17 - -[env:Nucleo-F411RE] -platform = ststm32 -board = nucleo_f411re -framework = arduino -lib_deps = ${env.lib_deps} -build_flags = -std=c++17 -Os -g2 -Wunused-variable -monitor_speed = 115200 -monitor_echo = yes - -[env:Nucleo-F446RE] -platform = ststm32 -board = nucleo_f446re -framework = arduino -lib_deps = ${env.lib_deps} -build_flags = -std=c++17 -Os -g2 -Wunused-variable -monitor_speed = 115200 -monitor_echo = yes - -[env:Teensy3.2] -platform = teensy -board = teensy31 -framework = arduino -build_flags = -std=c++17 -Os -g2 -lib_deps = ${env.lib_deps} -lib_ignore = NativeEthernet - -[env:Teensy3.5] -platform = teensy -board = teensy35 -framework = arduino -build_flags = -std=c++17 -Os -g2 -lib_deps = ${env.lib_deps} -lib_ignore = NativeEthernet - -[env:Teensy3.6] -platform = teensy -board = teensy36 -framework = arduino -build_flags = -std=c++17 -Os -g2 -lib_deps = ${env.lib_deps} -lib_ignore = NativeEthernet - -[env:Teensy4.0] -platform = teensy -board = teensy40 -framework = arduino -build_flags = -std=c++17 -Os -g2 -lib_deps = ${env.lib_deps} -lib_ignore = NativeEthernet - -[env:Teensy4.1] -platform = teensy -board = teensy41 -framework = arduino -build_flags = -std=c++17 -Os -g2 -lib_deps = ${env.lib_deps} -lib_ignore = -