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

AUTOSTART macro

Starts a new task at this point during initialisation.  (no need to put a separate start command at the beginning)
This commit is contained in:
Asbelos 2021-11-19 13:00:21 +00:00
parent 5cb427f774
commit 0018ba676b
3 changed files with 11 additions and 2 deletions

View File

@ -217,6 +217,11 @@ LookList * RMFT2::onCloseLookup=NULL;
onCloseLookup->add(operand,progCounter); onCloseLookup->add(operand,progCounter);
break; break;
case OPCODE_AUTOSTART:
// automatically create a task from here at startup.
new RMFT2(progCounter);
break;
default: // Ignore default: // Ignore
break; break;
} }
@ -769,6 +774,7 @@ void RMFT2::loop2() {
if (diag) DIAG(F("EXRAIL begin(%d)"),operand); if (diag) DIAG(F("EXRAIL begin(%d)"),operand);
break; break;
case OPCODE_AUTOSTART: // Handled only during begin process
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.
case OPCODE_SIGNAL: // Signal definition ignore at run time case OPCODE_SIGNAL: // Signal definition ignore at run time
case OPCODE_TURNOUT: // Turnout definition ignored at runtime case OPCODE_TURNOUT: // Turnout definition ignored at runtime

View File

@ -30,7 +30,7 @@
enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_FWD,OPCODE_REV,OPCODE_SPEED,OPCODE_INVERT_DIRECTION, OPCODE_FWD,OPCODE_REV,OPCODE_SPEED,OPCODE_INVERT_DIRECTION,
OPCODE_RESERVE,OPCODE_FREE, OPCODE_RESERVE,OPCODE_FREE,
OPCODE_AT,OPCODE_AFTER, 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_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT, OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT,

View File

@ -60,6 +60,7 @@
#define AFTER(sensor_id) #define AFTER(sensor_id)
#define AMBER(signal_id) #define AMBER(signal_id)
#define AT(sensor_id) #define AT(sensor_id)
#define AUTOSTART
#define CALL(route) #define CALL(route)
#define CLOSE(id) #define CLOSE(id)
#define DELAY(mindelay) #define DELAY(mindelay)
@ -159,6 +160,7 @@ const int StringMacroTracker1=__COUNTER__;
#undef AMBER #undef AMBER
#undef AT #undef AT
#undef AUTOMATION #undef AUTOMATION
#undef AUTOSTART
#undef CALL #undef CALL
#undef CLOSE #undef CLOSE
#undef DELAY #undef DELAY
@ -240,6 +242,7 @@ const int StringMacroTracker1=__COUNTER__;
#define AFTER(sensor_id) OPCODE_AT,V(sensor_id),OPCODE_AFTER,V(sensor_id), #define AFTER(sensor_id) OPCODE_AT,V(sensor_id),OPCODE_AFTER,V(sensor_id),
#define AMBER(signal_id) OPCODE_AMBER,V(signal_id), #define AMBER(signal_id) OPCODE_AMBER,V(signal_id),
#define AT(sensor_id) OPCODE_AT,V(sensor_id), #define AT(sensor_id) OPCODE_AT,V(sensor_id),
#define AUTOSTART OPCODE_AUTOSTART,NOP,
#define CALL(route) OPCODE_CALL,V(route), #define CALL(route) OPCODE_CALL,V(route),
#define CLOSE(id) OPCODE_CLOSE,V(id), #define CLOSE(id) OPCODE_CLOSE,V(id),
#define DELAY(ms) OPCODE_DELAY,V(ms/100L), #define DELAY(ms) OPCODE_DELAY,V(ms/100L),