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

FTOGGLE,XFTOGGLE

This commit is contained in:
Asbelos 2024-04-02 10:12:45 +01:00
parent 7a93cf7be8
commit c7ed47400d
5 changed files with 23 additions and 6 deletions

View File

@ -815,6 +815,10 @@ void RMFT2::loop2() {
case OPCODE_FOFF:
if (loco) DCC::setFn(loco,operand,false);
break;
case OPCODE_FTOGGLE:
if (loco) DCC::changeFn(loco,operand);
break;
case OPCODE_DRIVE:
{
@ -830,6 +834,10 @@ void RMFT2::loop2() {
case OPCODE_XFOFF:
DCC::setFn(operand,getOperand(1),false);
break;
case OPCODE_XFTOGGLE:
DCC::changeFn(operand,getOperand(1));
break;
case OPCODE_DCCACTIVATE: {
// operand is address<<3 | subaddr<<1 | active

View File

@ -44,6 +44,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_ENDIF,OPCODE_ELSE,
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_DELAYMS,OPCODE_RANDWAIT,
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
OPCODE_FTOGGLE,OPCODE_XFTOGGLE,
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,
OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN,

View File

@ -66,6 +66,7 @@
#undef FOLLOW
#undef FON
#undef FORGET
#undef FTOGGLE
#undef FREE
#undef FWD
#undef GREEN
@ -181,6 +182,7 @@
#undef WITHROTTLE
#undef XFOFF
#undef XFON
#undef XFTOGGLE
#ifndef RMFT2_UNDEF_ONLY
#define ACTIVATE(addr,subaddr)
@ -226,6 +228,7 @@
#define FON(func)
#define FORGET
#define FREE(blockid)
#define FTOGGLE(func)
#define FWD(speed)
#define GREEN(signal_id)
#define HAL(haltype,params...)
@ -340,4 +343,6 @@
#define WITHROTTLE(msg)
#define XFOFF(cab,func)
#define XFON(cab,func)
#define XFTOGGLE(cab,func)
#endif

View File

@ -36,7 +36,7 @@
void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]) {
(void)stream; // avoid compiler warning if we don't access this parameter
bool reject=false;
switch(opcode) {
case 'D':
@ -47,8 +47,7 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
break;
case '/': // New EXRAIL command
reject=!parseSlash(stream,paramCount,p);
opcode=0;
if (parseSlash(stream,paramCount,p)) opcode=0;
break;
case 'A': // <A address aspect>
@ -106,9 +105,11 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
}
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
int16_t eventid=p[0];
reject=eventid<0 || eventid>=countLCCLookup;
if (!reject) startNonRecursiveTask(F("LCC"),eventid,onLCCLookup[eventid]);
opcode=0;
bool reject = eventid<0 || eventid>=countLCCLookup;
if (!reject) {
startNonRecursiveTask(F("LCC"),eventid,onLCCLookup[eventid]);
opcode=0;
}
}
break;

View File

@ -490,6 +490,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#define FON(func) OPCODE_FON,V(func),
#define FORGET OPCODE_FORGET,0,0,
#define FREE(blockid) OPCODE_FREE,V(blockid),
#define FTOGGLE(func) OPCODE_FTOGGLE,V(func),
#define FWD(speed) OPCODE_FWD,V(speed),
#define GREEN(signal_id) OPCODE_GREEN,V(signal_id),
#define HAL(haltype,params...)
@ -618,6 +619,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#endif
#define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func),
#define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func),
#define XFTOGGLE(cab,func) OPCODE_XFTOGGLE,V(cab),OPCODE_PAD,V(func),
// Build RouteCode
const int StringMacroTracker2=__COUNTER__;