diff --git a/RMFT2.cpp b/RMFT2.cpp index bc9c01e..842b460 100644 --- a/RMFT2.cpp +++ b/RMFT2.cpp @@ -530,11 +530,19 @@ void RMFT2::loop2() { case OPCODE_FON: if (loco) DCC::setFn(loco,operand,true); break; - + case OPCODE_FOFF: if (loco) DCC::setFn(loco,operand,false); 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: progCounter=locateRouteStart(operand); if (progCounter<0) kill(F("FOLLOW unknown"), operand); @@ -631,7 +639,7 @@ void RMFT2::loop2() { case OPCODE_ROUTE: case OPCODE_AUTOMATION: case OPCODE_SEQUENCE: - DIAG(F("EXRAIL begin(%d)"),operand); + if (diag) DIAG(F("EXRAIL begin(%d)"),operand); break; case OPCODE_PAD: // Just a padding for previous opcode needing >1 operad byte. diff --git a/RMFT2.h b/RMFT2.h index 26cdf1d..a254070 100644 --- a/RMFT2.h +++ b/RMFT2.h @@ -34,7 +34,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET, OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE, 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_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR, OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN, diff --git a/RMFTMacros.h b/RMFTMacros.h index 3e1cde1..f638001 100644 --- a/RMFTMacros.h +++ b/RMFTMacros.h @@ -113,6 +113,8 @@ #define UNJOIN #define UNLATCH(sensor_id) #define WAITFOR(pin) +#define XFOFF(cab,func) +#define XFON(cab,func) #include "myAutomation.h" @@ -196,6 +198,8 @@ const int StringMacroTracker1=__COUNTER__; #undef UNJOIN #undef UNLATCH #undef WAITFOR +#undef XFOFF +#undef XFON // Define macros for route code creation #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 UNLATCH(sensor_id) OPCODE_UNLATCH,V(sensor_id), #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 const int StringMacroTracker2=__COUNTER__;