mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 12:51:24 +01:00
Merge branch 'EXRAILPlus' of https://github.com/DCC-EX/CommandStation-EX into EXRAILPlus
This commit is contained in:
commit
b0e81eec46
10
RMFT2.cpp
10
RMFT2.cpp
@ -695,6 +695,10 @@ void RMFT2::loop2() {
|
||||
case OPCODE_ENDIF:
|
||||
break;
|
||||
|
||||
case OPCODE_DELAYMS:
|
||||
delayMe(operand);
|
||||
break;
|
||||
|
||||
case OPCODE_DELAY:
|
||||
delayMe(operand*100L);
|
||||
break;
|
||||
@ -928,9 +932,9 @@ void RMFT2::kill(const FSH * reason, int operand) {
|
||||
// Hunt for an ONTHROW/ONCLOSE for this turnout
|
||||
int pc= (closed?onCloseLookup:onThrowLookup)->find(turnoutId);
|
||||
if (pc<0) return;
|
||||
|
||||
|
||||
// Check we dont already have a task running this turnout
|
||||
RMFT2 * task=loopTask;
|
||||
RMFT2 * task=loopTask;
|
||||
while(task) {
|
||||
if (task->onTurnoutId==turnoutId) {
|
||||
DIAG(F("Recursive ONTHROW/ONCLOSE for Turnout %d"),turnoutId);
|
||||
@ -940,8 +944,8 @@ void RMFT2::kill(const FSH * reason, int operand) {
|
||||
if (task==loopTask) break;
|
||||
}
|
||||
|
||||
task->onTurnoutId=turnoutId; // flag for recursion detector
|
||||
task=new RMFT2(pc); // new task starts at this instruction
|
||||
task->onTurnoutId=turnoutId; // flag for recursion detector
|
||||
}
|
||||
|
||||
void RMFT2::activateEvent(int16_t addr, bool activate) {
|
||||
|
2
RMFT2.h
2
RMFT2.h
@ -35,7 +35,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_IFCLOSED, OPCODE_IFTHROWN,OPCODE_ELSE,
|
||||
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_RANDWAIT,
|
||||
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_DELAYMS,OPCODE_RANDWAIT,
|
||||
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
|
||||
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,
|
||||
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,
|
||||
|
@ -124,6 +124,7 @@ const byte RMFT2::rosterNameCount=0
|
||||
#define ROSTER(cabid,name,funcmap...) StringFormatter::send(stream,(FSH *)format,F(name),cabid,cabid<128?'S':'L');
|
||||
void RMFT2::emitWithrottleRoster(Print * stream) {
|
||||
static const char format[] FLASH ="]\\[%S}|{%d}|{%c";
|
||||
(void)format;
|
||||
StringFormatter::send(stream,F("RL%d"), rosterNameCount);
|
||||
#include "myAutomation.h"
|
||||
stream->write('\n');
|
||||
@ -171,9 +172,9 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||
#define CLOSE(id) OPCODE_CLOSE,V(id),
|
||||
#define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1),
|
||||
#define DEACTIVATEL(addr) OPCODE_DCCACTIVATE,V((addr+3)<<3),
|
||||
#define DELAY(ms) OPCODE_DELAY,V(ms/100L),
|
||||
#define DELAY(ms) ms<30000?OPCODE_DELAYMS:OPCODE_DELAY,V(ms/(ms<30000?1L:100L)),
|
||||
#define DELAYMINS(mindelay) OPCODE_DELAYMINS,V(mindelay),
|
||||
#define DELAYRANDOM(mindelay,maxdelay) OPCODE_DELAY,V(mindelay/100L),OPCODE_RANDWAIT,V((maxdelay-mindelay)/100L),
|
||||
#define DELAYRANDOM(mindelay,maxdelay) DELAY(mindelay),OPCODE_RANDWAIT,V((maxdelay-mindelay)/100L),
|
||||
#define DONE OPCODE_ENDTASK,0,0,
|
||||
#define DRIVE(analogpin) OPCODE_DRIVE,V(analogpin),
|
||||
#define ELSE OPCODE_ELSE,0,0,
|
||||
|
Loading…
Reference in New Issue
Block a user