1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

SET_TRACK_DC/SET_TRACK_DCC

EXRAIL macros for TrackManager
SET_TRACK_DC sets the track to DC using the cab address of the current loco so you can drive..
This commit is contained in:
Asbelos 2022-02-24 11:50:22 +00:00
parent 74bbe595fc
commit 99e636974a
4 changed files with 14 additions and 2 deletions

View File

@ -656,7 +656,13 @@ void RMFT2::loop2() {
DCCWaveform::setJoin(false);
CommandDistributor::broadcastPower();
break;
case OPCODE_SET_TRACK:
// operand is track id and +128= Use my loco for DC
TrackManager::setTrackMode(operand & 0x0F,
operand>=128 ? loco : TrackManager::TRACK_MODE_MAIN);
break;
case OPCODE_RESUME:
pausingTask=NULL;
driveLoco(speedo);

View File

@ -48,7 +48,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT,
OPCODE_PRINT,OPCODE_DCCACTIVATE,
OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT,
OPCODE_ROSTER,
OPCODE_ROSTER,OPCODE_SET_TRACK,
OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL
};

View File

@ -98,6 +98,8 @@
#undef SERVO2
#undef SERVO_TURNOUT
#undef SET
#undef SET_TRACK_DC
#undef SET_TRACK_DCC
#undef SETLOCO
#undef SIGNAL
#undef SPEED
@ -187,6 +189,8 @@
#define SERVO2(id,position,duration)
#define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...)
#define SET(pin)
#define SET_TRACK_DC(trackid)
#define SET_TRACK_DCC(trackid)
#define SETLOCO(loco)
#define SIGNAL(redpin,amberpin,greenpin)
#define SPEED(speed)

View File

@ -236,6 +236,8 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
#define SERVO2(id,position,ms) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::Instant),OPCODE_PAD,V(ms/100L),
#define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...) OPCODE_SERVOTURNOUT,V(id),OPCODE_PAD,V(pin),OPCODE_PAD,V(activeAngle),OPCODE_PAD,V(inactiveAngle),OPCODE_PAD,V(PCA9685::ProfileType::profile),
#define SET(pin) OPCODE_SET,V(pin),
#define SET_TRACK_DC(track) OPCODE_SET_TRACK,V(128+track),
#define SET_TRACK_DCC(track) OPCODE_SET_TRACK,V(track),
#define SETLOCO(loco) OPCODE_SETLOCO,V(loco),
#define SIGNAL(redpin,amberpin,greenpin)
#define SPEED(speed) OPCODE_SPEED,V(speed),