1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-25 13:41:23 +01:00

XFON/XFOFF macros

This commit is contained in:
Asbelos 2021-09-06 12:27:21 +01:00
parent 9ba13a62c9
commit 222eca6524
3 changed files with 18 additions and 4 deletions

View File

@ -535,6 +535,14 @@ void RMFT2::loop2() {
if (loco) DCC::setFn(loco,operand,false); if (loco) DCC::setFn(loco,operand,false);
break; break;
case OPCODE_XFON:
DCC::setFn(operand,GET_OPERAND(1),true);
break;
case OPCODE_XFOFF:
DCC::setFn(operand,GET_OPERAND(1),false);
break;
case OPCODE_FOLLOW: case OPCODE_FOLLOW:
progCounter=locateRouteStart(operand); progCounter=locateRouteStart(operand);
if (progCounter<0) kill(F("FOLLOW unknown"), operand); if (progCounter<0) kill(F("FOLLOW unknown"), operand);
@ -631,7 +639,7 @@ void RMFT2::loop2() {
case OPCODE_ROUTE: case OPCODE_ROUTE:
case OPCODE_AUTOMATION: case OPCODE_AUTOMATION:
case OPCODE_SEQUENCE: case OPCODE_SEQUENCE:
DIAG(F("EXRAIL begin(%d)"),operand); if (diag) DIAG(F("EXRAIL begin(%d)"),operand);
break; break;
case OPCODE_PAD: // Just a padding for previous opcode needing >1 operad byte. case OPCODE_PAD: // Just a padding for previous opcode needing >1 operad byte.

View File

@ -34,7 +34,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET, OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET,
OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE, OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE,
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT, OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT,
OPCODE_FON,OPCODE_FOFF, OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER, OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR, OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,
OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN, OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN,

View File

@ -113,6 +113,8 @@
#define UNJOIN #define UNJOIN
#define UNLATCH(sensor_id) #define UNLATCH(sensor_id)
#define WAITFOR(pin) #define WAITFOR(pin)
#define XFOFF(cab,func)
#define XFON(cab,func)
#include "myAutomation.h" #include "myAutomation.h"
@ -196,6 +198,8 @@ const int StringMacroTracker1=__COUNTER__;
#undef UNJOIN #undef UNJOIN
#undef UNLATCH #undef UNLATCH
#undef WAITFOR #undef WAITFOR
#undef XFOFF
#undef XFON
// Define macros for route code creation // Define macros for route code creation
#define V(val) ((int16_t)(val))&0x00FF,((int16_t)(val)>>8)&0x00FF #define V(val) ((int16_t)(val))&0x00FF,((int16_t)(val)>>8)&0x00FF
@ -263,6 +267,8 @@ const int StringMacroTracker1=__COUNTER__;
#define UNJOIN OPCODE_UNJOIN,NOP, #define UNJOIN OPCODE_UNJOIN,NOP,
#define UNLATCH(sensor_id) OPCODE_UNLATCH,V(sensor_id), #define UNLATCH(sensor_id) OPCODE_UNLATCH,V(sensor_id),
#define WAITFOR(pin) OPCODE_WAITFOR,V(pin), #define WAITFOR(pin) OPCODE_WAITFOR,V(pin),
#define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func),
#define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func),
// PASS2 Build RouteCode // PASS2 Build RouteCode
const int StringMacroTracker2=__COUNTER__; const int StringMacroTracker2=__COUNTER__;