1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +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);
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;

View File

@ -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,

View File

@ -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

View File

@ -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),