mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 12:51:24 +01:00
SENDLOCO/START mixup
This commit is contained in:
parent
3ee7ba0b53
commit
1e61c2cd61
16
RMFT2.cpp
16
RMFT2.cpp
@ -547,12 +547,18 @@ void RMFT2::loop2() {
|
||||
|
||||
case OPCODE_START:
|
||||
{
|
||||
// Create new task and transfer loco.....
|
||||
// but cheat by swapping prog counters with new task
|
||||
int newPc=locateRouteStart(operand);
|
||||
int newPc=locateRouteStart(GET_OPERAND(1));
|
||||
if (newPc<0) break;
|
||||
new RMFT2(progCounter+3); // give new task my prog counter
|
||||
progCounter=newPc; // and I'll carry on from new task position
|
||||
new RMFT2(newPc);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPCODE_SENDLOCO: // cab, route
|
||||
{
|
||||
int newPc=locateRouteStart(GET_OPERAND(1));
|
||||
if (newPc<0) break;
|
||||
RMFT2* newtask=new RMFT2(newPc); // create new task
|
||||
newtask->loco=operand;
|
||||
}
|
||||
break;
|
||||
|
||||
|
2
RMFT2.h
2
RMFT2.h
@ -39,7 +39,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
|
||||
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,
|
||||
OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN,
|
||||
OPCODE_JOIN,OPCODE_UNJOIN,OPCODE_READ_LOCO1,OPCODE_READ_LOCO2,OPCODE_POM,
|
||||
OPCODE_START,OPCODE_SETLOCO,
|
||||
OPCODE_START,OPCODE_SETLOCO,OPCODE_SENDLOCO,
|
||||
OPCODE_PAUSE, OPCODE_RESUME,
|
||||
OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT,
|
||||
OPCODE_PRINT,
|
||||
|
@ -88,6 +88,7 @@
|
||||
#define RETURN
|
||||
#define REV(speed)
|
||||
#define START(route)
|
||||
#define SENDLOCO(cab,route)
|
||||
#define SERVO(id,position,profile)
|
||||
#define SETLOCO(loco)
|
||||
#define SET(sensor_id)
|
||||
@ -168,6 +169,7 @@ const int StringMacroTracker1=__COUNTER__;
|
||||
#undef START
|
||||
#undef SEQUENCE
|
||||
#undef SERVO
|
||||
#undef SENDLOCO
|
||||
#undef SETLOCO
|
||||
#undef SET
|
||||
#undef SPEED
|
||||
@ -226,6 +228,7 @@ const int StringMacroTracker1=__COUNTER__;
|
||||
#define RESUME OPCODE_RESUME,NOP,
|
||||
#define RETURN OPCODE_RETURN,NOP,
|
||||
#define REV(speed) OPCODE_REV,V(speed),
|
||||
#define SENDLOCO(cab,route) OPCODE_START,V(cab),OPCODE_PAD,V(route),
|
||||
#define START(route) OPCODE_START,V(route),
|
||||
#define SERVO(id,position,profile) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::ProfileType::profile),
|
||||
#define SETLOCO(loco) OPCODE_SETLOCO,V(loco),
|
||||
|
@ -26,10 +26,8 @@
|
||||
|
||||
EXRAIL // myAutomation must start with the EXRAIL instruction
|
||||
// This is the default starting route, AKA SEQUENCE(0)
|
||||
SETLOCO(3) // set current loco id...
|
||||
START(1) // send current loco off along route 1
|
||||
SETLOCO(10) // set current loco id...
|
||||
START(2) // send current loco off along route 2
|
||||
SENDLOCO(3,1) // send loco 3 off along route 1
|
||||
SENDLOCO(10,2) // send loco 10 off along route 2
|
||||
DONE // This just ends the startup thread, leaving 2 others running.
|
||||
|
||||
/* SEQUENCE(1) is a simple shuttle between 2 sensors
|
||||
|
Loading…
Reference in New Issue
Block a user