diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..3d53467 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: DCC-EX +patreon: dccex diff --git a/.github/workflows/label-sponsors.yml b/.github/workflows/label-sponsors.yml new file mode 100644 index 0000000..b5c7479 --- /dev/null +++ b/.github/workflows/label-sponsors.yml @@ -0,0 +1,14 @@ +name: Label sponsors +on: + pull_request: + types: [opened] + issues: + types: [opened] +jobs: + build: + name: is-sponsor-label + runs-on: ubuntu-latest + steps: + - uses: JasonEtco/is-sponsor-label-action@v1.2.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index f4f7c67..6392e96 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -360,7 +360,7 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { // check KILL ALL here, otherwise the next validation confuses ALL with a flag if (p[0]==HASH_KEYWORD_KILL && p[1]==HASH_KEYWORD_ALL) { - while (loopTask) delete loopTask; // destructor changes loopTask + while (loopTask) loopTask->kill(F("KILL ALL")); // destructor changes loopTask return true; } @@ -373,7 +373,7 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { RMFT2 * task=loopTask; while(task) { if (task->taskId==p[1]) { - delete task; + task->kill(F("KILL")); return true; } task=task->next; @@ -825,7 +825,11 @@ void RMFT2::loop2() { case OPCODE_ENDEXRAIL: kill(); return; - + + case OPCODE_KILLALL: + while(loopTask) loopTask->kill(F("KILLALL")); + return; + case OPCODE_JOIN: TrackManager::setPower(POWERMODE::ON); TrackManager::setJoin(true); diff --git a/EXRAIL2.h b/EXRAIL2.h index 578b2fe..5d6b6d4 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -49,7 +49,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT, OPCODE_PRINT,OPCODE_DCCACTIVATE, OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT, - OPCODE_ROSTER,OPCODE_SET_TRACK, + OPCODE_ROSTER,OPCODE_SET_TRACK,OPCODE_KILLALL, OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL }; diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 5766635..2c2037c 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -69,6 +69,7 @@ #undef IFTIMEOUT #undef INVERT_DIRECTION #undef JOIN +#undef KILLALL #undef LATCH #undef LCD #undef LCN @@ -78,6 +79,7 @@ #undef ONDEACTIVATEL #undef ONCLOSE #undef ONTHROW +#undef PARSE #undef PAUSE #undef PIN_TURNOUT #undef PRINT @@ -167,6 +169,7 @@ #define IFTIMEOUT #define INVERT_DIRECTION #define JOIN +#define KILLALL #define LATCH(sensor_id) #define LCD(row,msg) #define LCN(msg) @@ -179,6 +182,7 @@ #define PAUSE #define PIN_TURNOUT(id,pin,description...) #define PRINT(msg) +#define PARSE(msg) #define POM(cv,value) #define POWEROFF #define POWERON diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 19d862d..2ece342 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -71,6 +71,8 @@ void RMFT2::emitWithrottleDescriptions(Print * stream) { const int StringMacroTracker1=__COUNTER__; #undef BROADCAST #define BROADCAST(msg) case (__COUNTER__ - StringMacroTracker1) : CommandDistributor::broadcastText(F(msg));break; +#undef PARSE +#define PARSE(msg) case (__COUNTER__ - StringMacroTracker1) : DCCEXParser::parse(F(msg));break; #undef PRINT #define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break; #undef LCN @@ -215,6 +217,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define IFTIMEOUT OPCODE_IFTIMEOUT,0,0, #define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0, #define JOIN OPCODE_JOIN,0,0, +#define KILLALL OPCODE_KILLALL,0,0, #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LCD(id,msg) PRINT(msg) #define LCN(msg) PRINT(msg) @@ -230,6 +233,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define POWEROFF OPCODE_POWEROFF,0,0, #define POWERON OPCODE_POWERON,0,0, #define PRINT(msg) OPCODE_PRINT,V(__COUNTER__ - StringMacroTracker2), +#define PARSE(msg) PRINT(msg) #define READ_LOCO OPCODE_READ_LOCO1,0,0,OPCODE_READ_LOCO2,0,0, #define RED(signal_id) OPCODE_RED,V(signal_id), #define RESERVE(blockid) OPCODE_RESERVE,V(blockid), diff --git a/LCN.cpp b/LCN.cpp index 16b3f3f..efb49ff 100644 --- a/LCN.cpp +++ b/LCN.cpp @@ -50,7 +50,11 @@ void LCN::loop() { if (Diag::LCN) DIAG(F("LCN IN %d%c"),id,(char)ch); if (!Turnout::exists(id)) LCNTurnout::create(id); Turnout::setClosedStateOnly(id,ch=='t'); - Turnout::turnoutlistHash++; // signals ED update of turnout data + id = 0; + } + else if (ch == 'y' || ch == 'Y') { // Turnout opcodes + if (Diag::LCN) DIAG(F("LCN IN %d%c"),id,(char)ch); + Turnout::setClosed(id,ch=='y'); id = 0; } else if (ch == 'S' || ch == 's') { diff --git a/README.md b/README.md index 9062575..f820075 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Both CommandStation-EX and BaseStation-Classic support much of the NMRA Digital # What’s in this Repository? -This repository, CommandStation-EX, contains a complete DCC++ EX Commmand Station sketch designed for compiling and uploading into an Arduino Uno, Mega, or Nano. All sketch files are in the folder named CommandStation-EX and its subforlders. +This repository, CommandStation-EX, contains a complete DCC++ EX Commmand Station sketch designed for compiling and uploading into an Arduino Uno, Mega, or Nano. To utilize this sketch, you can use the following: @@ -69,7 +69,7 @@ in config.h. * Automatic slot (register) management * Automation (coming soon) -NOTE: DCC-EX is a major rewrite to the code. We started over and rebuilt it from the ground up! For what that means to you, click [HERE](notes/rewrite.md). +NOTE: DCC-EX is a major rewrite to the code. We started over and rebuilt it from the ground up! For what that means, you can read [HERE](https://dcc-ex.com/about/rewrite.html). # More information You can learn more at the [DCC++ EX website](https://dcc-ex.com/) diff --git a/version.h b/version.h index 940aeb5..cb08ff3 100644 --- a/version.h +++ b/version.h @@ -12,8 +12,9 @@ // Automatic ALIAS(name) // Command Parser now accepts Underscore in Alias Names // 4.0.2 EXRAIL additions: +// PARSE <> commands // VIRTUAL_TURNOUT -// command to stop all tasks. +// and KILLALL command to stop all tasks. // FORGET forgets the current loco in DCC reminder tables. // Servo signals (SERVO_SIGNAL) // High-On signal pins (SIGNALH)