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

Add IFTHROWN/IFCLOSED to Exrail

This commit is contained in:
Asbelos 2021-12-29 11:15:31 +00:00
parent a003d54fdd
commit 06a07a49cd
4 changed files with 18 additions and 1 deletions

View File

@ -500,11 +500,13 @@ bool RMFT2::skipIfBlock() {
kill(F("missing ENDIF"), nest); kill(F("missing ENDIF"), nest);
return false; return false;
case OPCODE_IF: case OPCODE_IF:
case OPCODE_IFCLOSED:
case OPCODE_IFGTE: case OPCODE_IFGTE:
case OPCODE_IFLT: case OPCODE_IFLT:
case OPCODE_IFNOT: case OPCODE_IFNOT:
case OPCODE_IFRANDOM: case OPCODE_IFRANDOM:
case OPCODE_IFRESERVE: case OPCODE_IFRESERVE:
case OPCODE_IFTHROWN:
nest++; nest++;
break; break;
case OPCODE_ENDIF: case OPCODE_ENDIF:
@ -661,6 +663,14 @@ void RMFT2::loop2() {
else if (!skipIfBlock()) return; else if (!skipIfBlock()) return;
break; 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: case OPCODE_ENDIF:
break; break;

View File

@ -33,6 +33,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_AT,OPCODE_AFTER,OPCODE_AUTOSTART, OPCODE_AT,OPCODE_AFTER,OPCODE_AUTOSTART,
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_IFCLOSED, OPCODE_IFTHROWN,
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT, OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT,
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF, OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE, OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,

View File

@ -52,11 +52,13 @@
#undef FWD #undef FWD
#undef GREEN #undef GREEN
#undef IF #undef IF
#undef IFCLOSED
#undef IFGTE #undef IFGTE
#undef IFLT #undef IFLT
#undef IFNOT #undef IFNOT
#undef IFRANDOM #undef IFRANDOM
#undef IFRESERVE #undef IFRESERVE
#undef IFTHROWN
#undef INVERT_DIRECTION #undef INVERT_DIRECTION
#undef JOIN #undef JOIN
#undef LATCH #undef LATCH
@ -136,10 +138,12 @@
#define FWD(speed) #define FWD(speed)
#define GREEN(signal_id) #define GREEN(signal_id)
#define IF(sensor_id) #define IF(sensor_id)
#define IFCLOSED(turnout_id)
#define IFGTE(sensor_id,value) #define IFGTE(sensor_id,value)
#define IFLT(sensor_id,value) #define IFLT(sensor_id,value)
#define IFNOT(sensor_id) #define IFNOT(sensor_id)
#define IFRANDOM(percent) #define IFRANDOM(percent)
#define IFTHROWN(turnout_id)
#define IFRESERVE(block) #define IFRESERVE(block)
#define INVERT_DIRECTION #define INVERT_DIRECTION
#define JOIN #define JOIN

View File

@ -181,11 +181,13 @@ const FSH * RMFT2::getRosterFunctions(int16_t cabid) {
#define FWD(speed) OPCODE_FWD,V(speed), #define FWD(speed) OPCODE_FWD,V(speed),
#define GREEN(signal_id) OPCODE_GREEN,V(signal_id), #define GREEN(signal_id) OPCODE_GREEN,V(signal_id),
#define IF(sensor_id) OPCODE_IF,V(sensor_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 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 IFLT(sensor_id,value) OPCODE_IFLT,V(sensor_id),OPCODE_PAD,V(value),
#define IFNOT(sensor_id) OPCODE_IFNOT,V(sensor_id), #define IFNOT(sensor_id) OPCODE_IFNOT,V(sensor_id),
#define IFRANDOM(percent) OPCODE_IFRANDOM,V(percent), #define IFRANDOM(percent) OPCODE_IFRANDOM,V(percent),
#define IFRESERVE(block) OPCODE_IFRESERVE,V(block), #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 INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0,
#define JOIN OPCODE_JOIN,0,0, #define JOIN OPCODE_JOIN,0,0,
#define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),