mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-30 03:26:13 +01:00
Squashed commit of the following:
commit a2b3ee8b5d52c2eefa461ace8f95c7f782a58efc Merge: fc1217b3d6c935
Author: Asbelos <asbelos@btinternet.com> Date: Thu Jun 13 11:58:00 2024 +0100 Merge branch 'devel' into devel_merg commit fc1217b8fa27a83174a4cf3bb82666f075103637 Author: Asbelos <asbelos@btinternet.com> Date: Thu Jun 13 11:57:12 2024 +0100 Update EXRAIL2Parser.cpp commitb89508671c
Author: Asbelos <asbelos@btinternet.com> Date: Wed Jun 12 16:25:17 2024 +0100 Separate <L> polling cycle commit9f1257bc6c
Merge:a2fb585
5f65fd5
Author: Asbelos <asbelos@btinternet.com> Date: Wed Jun 12 10:57:09 2024 +0100 Merge branch 'devel' into devel_merg commita2fb58584f
Author: Asbelos <asbelos@btinternet.com> Date: Fri May 31 19:49:39 2024 +0100 ACON/ACOF 32 bit + 1=OFF commitfca4ea052e
Author: Asbelos <asbelos@btinternet.com> Date: Fri May 31 12:09:38 2024 +0100 Rename to ACON/ACOF terminology commit0d07aa6271
Author: Asbelos <asbelos@btinternet.com> Date: Thu May 30 19:59:29 2024 +0100 MERG macris in exrail
This commit is contained in:
parent
3d6c935308
commit
97f9fb4813
10
EXRAIL2.cpp
10
EXRAIL2.cpp
|
@ -1001,6 +1001,14 @@ void RMFT2::loop2() {
|
||||||
StringFormatter::send(LCCSerial,F("<L x%h>"),(uint16_t)operand);
|
StringFormatter::send(LCCSerial,F("<L x%h>"),(uint16_t)operand);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPCODE_ACON: // MERG adapter
|
||||||
|
case OPCODE_ACOF:
|
||||||
|
if ((compileFeatures & FEATURE_LCC) && LCCSerial)
|
||||||
|
StringFormatter::send(LCCSerial,F("<L x%c%h%h>"),
|
||||||
|
opcode==OPCODE_ACON?'0':'1',
|
||||||
|
(uint16_t)operand,getOperand(progCounter,1));
|
||||||
|
break;
|
||||||
|
|
||||||
case OPCODE_LCCX: // long form LCC
|
case OPCODE_LCCX: // long form LCC
|
||||||
if ((compileFeatures & FEATURE_LCC) && LCCSerial)
|
if ((compileFeatures & FEATURE_LCC) && LCCSerial)
|
||||||
StringFormatter::send(LCCSerial,F("<L x%h%h%h%h>\n"),
|
StringFormatter::send(LCCSerial,F("<L x%h%h%h%h>\n"),
|
||||||
|
@ -1088,6 +1096,8 @@ void RMFT2::loop2() {
|
||||||
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
||||||
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
||||||
case OPCODE_ONLCC: // LCC event catchers ignored here
|
case OPCODE_ONLCC: // LCC event catchers ignored here
|
||||||
|
case OPCODE_ONACON: // MERG event catchers ignored here
|
||||||
|
case OPCODE_ONACOF: // MERG event catchers ignored here
|
||||||
case OPCODE_ONTHROW:
|
case OPCODE_ONTHROW:
|
||||||
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
||||||
case OPCODE_ONDEACTIVATE:
|
case OPCODE_ONDEACTIVATE:
|
||||||
|
|
|
@ -69,6 +69,8 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,OPCODE_TOGGLE_TURNOUT,
|
||||||
OPCODE_TTADDPOSITION,OPCODE_DCCTURNTABLE,OPCODE_EXTTTURNTABLE,
|
OPCODE_TTADDPOSITION,OPCODE_DCCTURNTABLE,OPCODE_EXTTTURNTABLE,
|
||||||
OPCODE_ONROTATE,OPCODE_ROTATE,OPCODE_WAITFORTT,
|
OPCODE_ONROTATE,OPCODE_ROTATE,OPCODE_WAITFORTT,
|
||||||
OPCODE_LCC,OPCODE_LCCX,OPCODE_ONLCC,
|
OPCODE_LCC,OPCODE_LCCX,OPCODE_ONLCC,
|
||||||
|
OPCODE_ACON, OPCODE_ACOF,
|
||||||
|
OPCODE_ONACON, OPCODE_ONACOF,
|
||||||
OPCODE_ONOVERLOAD,
|
OPCODE_ONOVERLOAD,
|
||||||
OPCODE_ROUTE_ACTIVE,OPCODE_ROUTE_INACTIVE,OPCODE_ROUTE_HIDDEN,
|
OPCODE_ROUTE_ACTIVE,OPCODE_ROUTE_INACTIVE,OPCODE_ROUTE_HIDDEN,
|
||||||
OPCODE_ROUTE_DISABLED,
|
OPCODE_ROUTE_DISABLED,
|
||||||
|
|
|
@ -99,6 +99,10 @@
|
||||||
#undef LCCX
|
#undef LCCX
|
||||||
#undef LCN
|
#undef LCN
|
||||||
#undef MOVETT
|
#undef MOVETT
|
||||||
|
#undef ACON
|
||||||
|
#undef ACOF
|
||||||
|
#undef ONACON
|
||||||
|
#undef ONACOF
|
||||||
#undef MESSAGE
|
#undef MESSAGE
|
||||||
#undef ONACTIVATE
|
#undef ONACTIVATE
|
||||||
#undef ONACTIVATEL
|
#undef ONACTIVATEL
|
||||||
|
@ -265,6 +269,10 @@
|
||||||
#define LCN(msg)
|
#define LCN(msg)
|
||||||
#define MESSAGE(msg)
|
#define MESSAGE(msg)
|
||||||
#define MOVETT(id,steps,activity)
|
#define MOVETT(id,steps,activity)
|
||||||
|
#define ACON(eventid)
|
||||||
|
#define ACOF(eventid)
|
||||||
|
#define ONACON(eventid)
|
||||||
|
#define ONACOF(eventid)
|
||||||
#define ONACTIVATE(addr,subaddr)
|
#define ONACTIVATE(addr,subaddr)
|
||||||
#define ONACTIVATEL(linear)
|
#define ONACTIVATEL(linear)
|
||||||
#define ONAMBER(signal_id)
|
#define ONAMBER(signal_id)
|
||||||
|
|
|
@ -61,48 +61,86 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
|
||||||
case 'L':
|
case 'L':
|
||||||
// This entire code block is compiled out if LLC macros not used
|
// This entire code block is compiled out if LLC macros not used
|
||||||
if (!(compileFeatures & FEATURE_LCC)) return;
|
if (!(compileFeatures & FEATURE_LCC)) return;
|
||||||
|
static int lccProgCounter=0;
|
||||||
|
static int lccEventIndex=0;
|
||||||
|
|
||||||
if (paramCount==0) { //<L> LCC adapter introducing self
|
if (paramCount==0) { //<L> LCC adapter introducing self
|
||||||
LCCSerial=stream; // now we know where to send events we raise
|
LCCSerial=stream; // now we know where to send events we raise
|
||||||
|
opcode=0; // flag command as intercepted
|
||||||
|
|
||||||
// loop through all possible sent events
|
// loop through all possible sent/waited events
|
||||||
for (int progCounter=0;; SKIPOP) {
|
for (int progCounter=lccProgCounter;; SKIPOP) {
|
||||||
byte opcode=GET_OPCODE;
|
byte exrailOpcode=GET_OPCODE;
|
||||||
if (opcode==OPCODE_ENDEXRAIL) break;
|
switch (exrailOpcode) {
|
||||||
if (opcode==OPCODE_LCC) StringFormatter::send(stream,F("<LS x%h>\n"),getOperand(progCounter,0));
|
case OPCODE_ENDEXRAIL:
|
||||||
if (opcode==OPCODE_LCCX) { // long form LCC
|
stream->print(F("<LR>\n")); // ready to roll
|
||||||
|
lccProgCounter=0; // allow a second pass
|
||||||
|
lccEventIndex=0;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_LCC:
|
||||||
|
StringFormatter::send(stream,F("<LS x%h>\n"),getOperand(progCounter,0));
|
||||||
|
SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_LCCX: // long form LCC
|
||||||
StringFormatter::send(stream,F("<LS x%h%h%h%h>\n"),
|
StringFormatter::send(stream,F("<LS x%h%h%h%h>\n"),
|
||||||
getOperand(progCounter,1),
|
getOperand(progCounter,1),
|
||||||
getOperand(progCounter,2),
|
getOperand(progCounter,2),
|
||||||
getOperand(progCounter,3),
|
getOperand(progCounter,3),
|
||||||
getOperand(progCounter,0)
|
getOperand(progCounter,0)
|
||||||
);
|
);
|
||||||
}}
|
SKIPOP;SKIPOP;SKIPOP;SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_ACON: // CBUS ACON
|
||||||
|
case OPCODE_ACOF: // CBUS ACOF
|
||||||
|
StringFormatter::send(stream,F("<LS x%c%h%h>\n"),
|
||||||
|
exrailOpcode==OPCODE_ACOF?'1':'0',
|
||||||
|
getOperand(progCounter,0),getOperand(progCounter,1));
|
||||||
|
SKIPOP;SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
// we stream the hex events we wish to listen to
|
// we stream the hex events we wish to listen to
|
||||||
// and at the same time build the event index looku.
|
// and at the same time build the event index looku.
|
||||||
|
|
||||||
|
case OPCODE_ONLCC:
|
||||||
int eventIndex=0;
|
|
||||||
for (int progCounter=0;; SKIPOP) {
|
|
||||||
byte opcode=GET_OPCODE;
|
|
||||||
if (opcode==OPCODE_ENDEXRAIL) break;
|
|
||||||
if (opcode==OPCODE_ONLCC) {
|
|
||||||
onLCCLookup[eventIndex]=progCounter; // TODO skip...
|
|
||||||
StringFormatter::send(stream,F("<LL %d x%h%h%h:%h>\n"),
|
StringFormatter::send(stream,F("<LL %d x%h%h%h:%h>\n"),
|
||||||
eventIndex,
|
lccEventIndex,
|
||||||
getOperand(progCounter,1),
|
getOperand(progCounter,1),
|
||||||
getOperand(progCounter,2),
|
getOperand(progCounter,2),
|
||||||
getOperand(progCounter,3),
|
getOperand(progCounter,3),
|
||||||
getOperand(progCounter,0)
|
getOperand(progCounter,0)
|
||||||
);
|
);
|
||||||
eventIndex++;
|
SKIPOP;SKIPOP;SKIPOP;SKIPOP;
|
||||||
}
|
// start on handler at next
|
||||||
}
|
onLCCLookup[lccEventIndex]=progCounter;
|
||||||
StringFormatter::send(stream,F("<LR>\n")); // Ready to rumble
|
lccEventIndex++;
|
||||||
opcode=0;
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_ONACON:
|
||||||
|
case OPCODE_ONACOF:
|
||||||
|
StringFormatter::send(stream,F("<LL %d x%c%h%h>\n"),
|
||||||
|
lccEventIndex,
|
||||||
|
exrailOpcode==OPCODE_ONACOF?'1':'0',
|
||||||
|
getOperand(progCounter,0),getOperand(progCounter,1)
|
||||||
|
);
|
||||||
|
SKIPOP;SKIPOP;
|
||||||
|
// start on handler at next
|
||||||
|
onLCCLookup[lccEventIndex]=progCounter;
|
||||||
|
lccEventIndex++;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
|
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
|
||||||
int16_t eventid=p[0];
|
int16_t eventid=p[0];
|
||||||
bool reject = eventid<0 || eventid>=countLCCLookup;
|
bool reject = eventid<0 || eventid>=countLCCLookup;
|
||||||
|
|
|
@ -189,6 +189,14 @@ bool exrailHalSetup() {
|
||||||
#define LCCX(senderid,eventid) | FEATURE_LCC
|
#define LCCX(senderid,eventid) | FEATURE_LCC
|
||||||
#undef ONLCC
|
#undef ONLCC
|
||||||
#define ONLCC(senderid,eventid) | FEATURE_LCC
|
#define ONLCC(senderid,eventid) | FEATURE_LCC
|
||||||
|
#undef ACON
|
||||||
|
#define ACON(eventid) | FEATURE_LCC
|
||||||
|
#undef ACOF
|
||||||
|
#define ACOF(eventid) | FEATURE_LCC
|
||||||
|
#undef ONACON
|
||||||
|
#define ONACON(eventid) | FEATURE_LCC
|
||||||
|
#undef ONACOF
|
||||||
|
#define ONACOF(eventid) | FEATURE_LCC
|
||||||
#undef ROUTE_ACTIVE
|
#undef ROUTE_ACTIVE
|
||||||
#define ROUTE_ACTIVE(id) | FEATURE_ROUTESTATE
|
#define ROUTE_ACTIVE(id) | FEATURE_ROUTESTATE
|
||||||
#undef ROUTE_INACTIVE
|
#undef ROUTE_INACTIVE
|
||||||
|
@ -429,10 +437,14 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
0,0,0,0 };
|
0,0,0,0 };
|
||||||
|
|
||||||
// Pass 9 ONLCC counter and lookup array
|
// Pass 9 ONLCC/ ONMERG counter and lookup array
|
||||||
#include "EXRAIL2MacroReset.h"
|
#include "EXRAIL2MacroReset.h"
|
||||||
#undef ONLCC
|
#undef ONLCC
|
||||||
#define ONLCC(sender,event) +1
|
#define ONLCC(sender,event) +1
|
||||||
|
#undef ONACON
|
||||||
|
#define ONACON(event) +1
|
||||||
|
#undef ONACOF
|
||||||
|
#define ONACOF(event) +1
|
||||||
|
|
||||||
const int RMFT2::countLCCLookup=0
|
const int RMFT2::countLCCLookup=0
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
|
@ -529,6 +541,10 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
|
||||||
OPCODE_PAD,V((((uint64_t)sender)>>32)&0xFFFF),\
|
OPCODE_PAD,V((((uint64_t)sender)>>32)&0xFFFF),\
|
||||||
OPCODE_PAD,V((((uint64_t)sender)>>16)&0xFFFF),\
|
OPCODE_PAD,V((((uint64_t)sender)>>16)&0xFFFF),\
|
||||||
OPCODE_PAD,V((((uint64_t)sender)>>0)&0xFFFF),
|
OPCODE_PAD,V((((uint64_t)sender)>>0)&0xFFFF),
|
||||||
|
#define ACON(eventid) OPCODE_ACON,V(((uint32_t)eventid >>16) & 0xFFFF),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
|
#define ACOF(eventid) OPCODE_ACOF,V(((uint32_t)eventid >>16) & 0xFFFF),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
|
#define ONACON(eventid) OPCODE_ONACON,V((uint32_t)(eventid) >>16),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
|
#define ONACOF(eventid) OPCODE_ONACOF,V((uint32_t)(eventid) >>16),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
#define LCD(id,msg) PRINT(msg)
|
#define LCD(id,msg) PRINT(msg)
|
||||||
#define SCREEN(display,id,msg) PRINT(msg)
|
#define SCREEN(display,id,msg) PRINT(msg)
|
||||||
#define STEALTH(code...) PRINT(dummy)
|
#define STEALTH(code...) PRINT(dummy)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user