diff --git a/RMFT2.cpp b/RMFT2.cpp index 44c1c32..08a5697 100644 --- a/RMFT2.cpp +++ b/RMFT2.cpp @@ -500,11 +500,13 @@ bool RMFT2::skipIfBlock() { kill(F("missing ENDIF"), nest); return false; case OPCODE_IF: + case OPCODE_IFCLOSED: case OPCODE_IFGTE: case OPCODE_IFLT: case OPCODE_IFNOT: case OPCODE_IFRANDOM: case OPCODE_IFRESERVE: + case OPCODE_IFTHROWN: nest++; break; case OPCODE_ENDIF: @@ -660,7 +662,15 @@ void RMFT2::loop2() { if (!getFlag(operand,SECTION_FLAG)) setFlag(operand,SECTION_FLAG); else if (!skipIfBlock()) return; break; + + case OPCODE_IFTHROWN: + if (Turnout::isClosed(operand)) if (!skipIfBlock()) return; + break; + case OPCODE_IFCLOSED: + if (!Turnout::isClosed(operand)) if (!skipIfBlock()) return; + break; + case OPCODE_ENDIF: break; diff --git a/RMFT2.h b/RMFT2.h index 0e1c82f..d961054 100644 --- a/RMFT2.h +++ b/RMFT2.h @@ -33,6 +33,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_AT,OPCODE_AFTER,OPCODE_AUTOSTART, OPCODE_LATCH,OPCODE_UNLATCH,OPCODE_SET,OPCODE_RESET, OPCODE_IF,OPCODE_IFNOT,OPCODE_ENDIF,OPCODE_IFRANDOM,OPCODE_IFRESERVE, + OPCODE_IFCLOSED, OPCODE_IFTHROWN, OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT, OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF, OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE, diff --git a/RMFT2MacroReset.h b/RMFT2MacroReset.h index d7bf009..c95fc43 100644 --- a/RMFT2MacroReset.h +++ b/RMFT2MacroReset.h @@ -52,11 +52,13 @@ #undef FWD #undef GREEN #undef IF +#undef IFCLOSED #undef IFGTE #undef IFLT #undef IFNOT #undef IFRANDOM #undef IFRESERVE +#undef IFTHROWN #undef INVERT_DIRECTION #undef JOIN #undef LATCH @@ -136,10 +138,12 @@ #define FWD(speed) #define GREEN(signal_id) #define IF(sensor_id) +#define IFCLOSED(turnout_id) #define IFGTE(sensor_id,value) #define IFLT(sensor_id,value) #define IFNOT(sensor_id) -#define IFRANDOM(percent) +#define IFRANDOM(percent) +#define IFTHROWN(turnout_id) #define IFRESERVE(block) #define INVERT_DIRECTION #define JOIN diff --git a/RMFTMacros.h b/RMFTMacros.h index f03cfad..e0151aa 100644 --- a/RMFTMacros.h +++ b/RMFTMacros.h @@ -181,11 +181,13 @@ const FSH * RMFT2::getRosterFunctions(int16_t cabid) { #define FWD(speed) OPCODE_FWD,V(speed), #define GREEN(signal_id) OPCODE_GREEN,V(signal_id), #define IF(sensor_id) OPCODE_IF,V(sensor_id), +#define IFCLOSED(turnout_id) OPCODE_IFCLOSED,V(turnout_id), #define IFGTE(sensor_id,value) OPCODE_IFGTE,V(sensor_id),OPCODE_PAD,V(value), #define IFLT(sensor_id,value) OPCODE_IFLT,V(sensor_id),OPCODE_PAD,V(value), #define IFNOT(sensor_id) OPCODE_IFNOT,V(sensor_id), #define IFRANDOM(percent) OPCODE_IFRANDOM,V(percent), #define IFRESERVE(block) OPCODE_IFRESERVE,V(block), +#define IFTHROWN(turnout_id) OPCODE_IFTHROWN,V(turnout_id), #define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0, #define JOIN OPCODE_JOIN,0,0, #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),