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

Merge branch 'ServoSignal' into TrackManager

This commit is contained in:
Asbelos 2022-03-31 22:20:33 +01:00
commit aaa3e7a83c
9 changed files with 41 additions and 8 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
github: DCC-EX
patreon: dccex

14
.github/workflows/label-sponsors.yml vendored Normal file
View File

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

View File

@ -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 // check KILL ALL here, otherwise the next validation confuses ALL with a flag
if (p[0]==HASH_KEYWORD_KILL && p[1]==HASH_KEYWORD_ALL) { 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; return true;
} }
@ -373,7 +373,7 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) {
RMFT2 * task=loopTask; RMFT2 * task=loopTask;
while(task) { while(task) {
if (task->taskId==p[1]) { if (task->taskId==p[1]) {
delete task; task->kill(F("KILL"));
return true; return true;
} }
task=task->next; task=task->next;
@ -826,6 +826,10 @@ void RMFT2::loop2() {
kill(); kill();
return; return;
case OPCODE_KILLALL:
while(loopTask) loopTask->kill(F("KILLALL"));
return;
case OPCODE_JOIN: case OPCODE_JOIN:
TrackManager::setPower(POWERMODE::ON); TrackManager::setPower(POWERMODE::ON);
TrackManager::setJoin(true); TrackManager::setJoin(true);

View File

@ -49,7 +49,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT, OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT,
OPCODE_PRINT,OPCODE_DCCACTIVATE, OPCODE_PRINT,OPCODE_DCCACTIVATE,
OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT, 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 OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL
}; };

View File

@ -69,6 +69,7 @@
#undef IFTIMEOUT #undef IFTIMEOUT
#undef INVERT_DIRECTION #undef INVERT_DIRECTION
#undef JOIN #undef JOIN
#undef KILLALL
#undef LATCH #undef LATCH
#undef LCD #undef LCD
#undef LCN #undef LCN
@ -78,6 +79,7 @@
#undef ONDEACTIVATEL #undef ONDEACTIVATEL
#undef ONCLOSE #undef ONCLOSE
#undef ONTHROW #undef ONTHROW
#undef PARSE
#undef PAUSE #undef PAUSE
#undef PIN_TURNOUT #undef PIN_TURNOUT
#undef PRINT #undef PRINT
@ -167,6 +169,7 @@
#define IFTIMEOUT #define IFTIMEOUT
#define INVERT_DIRECTION #define INVERT_DIRECTION
#define JOIN #define JOIN
#define KILLALL
#define LATCH(sensor_id) #define LATCH(sensor_id)
#define LCD(row,msg) #define LCD(row,msg)
#define LCN(msg) #define LCN(msg)
@ -179,6 +182,7 @@
#define PAUSE #define PAUSE
#define PIN_TURNOUT(id,pin,description...) #define PIN_TURNOUT(id,pin,description...)
#define PRINT(msg) #define PRINT(msg)
#define PARSE(msg)
#define POM(cv,value) #define POM(cv,value)
#define POWEROFF #define POWEROFF
#define POWERON #define POWERON

View File

@ -71,6 +71,8 @@ void RMFT2::emitWithrottleDescriptions(Print * stream) {
const int StringMacroTracker1=__COUNTER__; const int StringMacroTracker1=__COUNTER__;
#undef BROADCAST #undef BROADCAST
#define BROADCAST(msg) case (__COUNTER__ - StringMacroTracker1) : CommandDistributor::broadcastText(F(msg));break; #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 #undef PRINT
#define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break; #define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break;
#undef LCN #undef LCN
@ -215,6 +217,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
#define IFTIMEOUT OPCODE_IFTIMEOUT,0,0, #define IFTIMEOUT OPCODE_IFTIMEOUT,0,0,
#define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0, #define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0,
#define JOIN OPCODE_JOIN,0,0, #define JOIN OPCODE_JOIN,0,0,
#define KILLALL OPCODE_KILLALL,0,0,
#define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),
#define LCD(id,msg) PRINT(msg) #define LCD(id,msg) PRINT(msg)
#define LCN(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 POWEROFF OPCODE_POWEROFF,0,0,
#define POWERON OPCODE_POWERON,0,0, #define POWERON OPCODE_POWERON,0,0,
#define PRINT(msg) OPCODE_PRINT,V(__COUNTER__ - StringMacroTracker2), #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 READ_LOCO OPCODE_READ_LOCO1,0,0,OPCODE_READ_LOCO2,0,0,
#define RED(signal_id) OPCODE_RED,V(signal_id), #define RED(signal_id) OPCODE_RED,V(signal_id),
#define RESERVE(blockid) OPCODE_RESERVE,V(blockid), #define RESERVE(blockid) OPCODE_RESERVE,V(blockid),

View File

@ -50,7 +50,11 @@ void LCN::loop() {
if (Diag::LCN) DIAG(F("LCN IN %d%c"),id,(char)ch); if (Diag::LCN) DIAG(F("LCN IN %d%c"),id,(char)ch);
if (!Turnout::exists(id)) LCNTurnout::create(id); if (!Turnout::exists(id)) LCNTurnout::create(id);
Turnout::setClosedStateOnly(id,ch=='t'); 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; id = 0;
} }
else if (ch == 'S' || ch == 's') { else if (ch == 'S' || ch == 's') {

View File

@ -22,7 +22,7 @@ Both CommandStation-EX and BaseStation-Classic support much of the NMRA Digital
# Whats in this Repository? # Whats 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: To utilize this sketch, you can use the following:
@ -69,7 +69,7 @@ in config.h.
* Automatic slot (register) management * Automatic slot (register) management
* Automation (coming soon) * 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 # More information
You can learn more at the [DCC++ EX website](https://dcc-ex.com/) You can learn more at the [DCC++ EX website](https://dcc-ex.com/)

View File

@ -12,8 +12,9 @@
// Automatic ALIAS(name) // Automatic ALIAS(name)
// Command Parser now accepts Underscore in Alias Names // Command Parser now accepts Underscore in Alias Names
// 4.0.2 EXRAIL additions: // 4.0.2 EXRAIL additions:
// PARSE <> commands
// VIRTUAL_TURNOUT // VIRTUAL_TURNOUT
// </KILL ALL> command to stop all tasks. // </KILL ALL> and KILLALL command to stop all tasks.
// FORGET forgets the current loco in DCC reminder tables. // FORGET forgets the current loco in DCC reminder tables.
// Servo signals (SERVO_SIGNAL) // Servo signals (SERVO_SIGNAL)
// High-On signal pins (SIGNALH) // High-On signal pins (SIGNALH)