Welcome to EXRAIL2MacroReset’s documentation!
Introduction
EXRAIL - Extended Railroad Automation Instruction Language
This page is a reference to all EXRAIL commands available with EX-CommandStation.
Macros
Defines
-
ACTIVATE(addr, subaddr)
Send DCC Accessory Activate packet (gate on then off)
- Parameters:
addr
subaddr
-
ACTIVATEL(longaddr)
Send DCC Accessory Activate packet (gate on then off)
- Parameters:
longaddr
-
AFTER(sensor_id, timer...)
Wait for sensor activated, then decativated for given time.
- Parameters:
sensor_id
timer... – optional wait in mS, default 500
-
AFTEROVERLOAD(track_id)
Wait for overload to be resolved.
- Parameters:
track_id – A..H
-
ALIAS(name, value...)
defines a named numeric value.
- Parameters:
name
value... – if omitted, a large negative value is created automatically
-
AMBER(signal_id)
Sets a signal to amber state.
- Parameters:
signal_id
-
ANOUT(vpin, value, param1, param2)
Writes to the HAL analog output interface of a device driver. Values and meanings of extra parameters depend on driver.
- Parameters:
vpin – Virtual pin number of device
value – basic analog value
param1 – device dependent
param2 – device dependent
-
AT(sensor_id)
wait intil a sensor becomes active
- Parameters:
sensor_id – Use negative value for sensors that are HIGH when activated
-
ASPECT(address, value)
Sends a DCC aspect value to an accessory address. May also change status of a signal defined using this aspect.
- Parameters:
address
value
-
ATGTE(sensor_id, value)
Wait for analog sensor to be greater than given value.
- Parameters:
sensor_id
value
-
ATLT(sensor_id, value)
Wait for analog sensor value to be less than given value.
- Parameters:
sensor_id
value
-
ATTIMEOUT(sensor_id, timeout_ms)
Wait for sensor active, with timeout. Use IFTIMEOUT to determine whether the AT was satisfied.
See also
- Parameters:
sensor_id
timeout_ms
-
AUTOMATION(id, description)
Defies starting point of a sequence that will be shown as an Automation by the throttles. Automations are started by the throttle handing over a loco id to be driven.
- Parameters:
id – Unique sequence/route/automation id
description – (Quoted text) will be shown on throttle button
-
AUTOSTART
A new task will be created starting from this point at Command Station startup
-
BLINK(vpin, onDuty, offDuty)
Starts a blinking process for a vpin (typically a LED) Stop blink with SET or RESET.
- Parameters:
vpin
onDuty – Milliseconds with LED ON
offDuty – Milliseconds with LED off
-
BROADCAST(msg)
Send raw message text to all throttles using the DCC-EX protocol.
See also
- Parameters:
msg – Quoted message
-
CALL(route)
transfer control to another sequence with expectation to return
See also
- Parameters:
route – Sequence id, sequence must terminate of RETURN
-
CLEAR_STASH(id)
Clears loco stash value
- Parameters:
id – which stash to clear.
-
CLEAR_ALL_STASH(id)
???????????????????????????????????????
- Parameters:
id
-
CONFIGURE_SERVO(vpin, pos1, pos2, profile)
setup servo movement parameters for non-turnout
- Parameters:
vpin – must refer to a servo capable pin
pos1 – SET position of servo
pos2 – RESET position of servo
profile – Movement profile (????????)
-
DCC_SIGNAL(id, add, subaddr)
Define a DCC accessory signal with short address.
- Parameters:
id – Signal id used for all signal manipulation commands
add – DCC address
subaddr – DCC subaddress
-
DCCX_SIGNAL(id, redAspect, amberAspect, greenAspect)
DEfine advanced DCC accessory signal with aspects.
- Parameters:
id – Signal id used for all signal manipulation commands
redAspect
amberAspect
greenAspect
-
DCC_TURNTABLE(id, home, description...)
??????????????????????????????????
- Parameters:
id
home
description...
-
DEACTIVATE(addr, subaddr)
Sends DCC Deactivate packet (gate on, gate off) to short address.
- Parameters:
addr
subaddr
-
DEACTIVATEL(addr)
Sends DCC Deactivate packet (gate on, gate off) to long address.
- Parameters:
addr
-
DELAY(mindelay)
Waits for given milliseconds delay (This is not blocking)
- Parameters:
mindelay – mS
-
DELAYMINS(mindelay)
Waits for given minutes delay (This is not blocking)
- Parameters:
mindelay
-
DELAYRANDOM(mindelay, maxdelay)
Waits for random delay between min and max milliseconds (This is not blocking)
- Parameters:
mindelay – mS
maxdelay – mS
-
DONE
Stops task loco (if any) and terminates current task.
-
DRIVE(analogpin)
RESERVED do not use.
- Parameters:
analogpin
-
ELSE
introduces alternate processing path after any kind of IF
-
ENDEXRAIL
Obsolete, has no effect.
-
ENDIF
determines end of IF(any type)
block. IF something ENDIF, or
IF something ELSE something ENDIF
-
ESTOP
Performs emergency stop on current task loco.
-
EXRAIL
OBSOLETE ignored.
-
EXTT_TURNTABLE(id, vpin, home, description...)
??????????????????????
- Parameters:
id
vpin
home
description...
-
FADE(pin, value, ms)
Modifies analog value slowly taking a given time.
- Parameters:
pin
value – new target value
ms – time to reach value
-
FOLLOW(route)
Task processing follows given route or sequence (Effectively a GoTo)
- Parameters:
route
-
FORGET
Removes current loco from task and DCC reminders table.
-
FTOGGLE(func)
Toggles function for current loco.
- Parameters:
func
-
FWD(speed)
Instructs current loco to set DCC speed.
- Parameters:
speed – 0..127 (1=ESTOP)
-
GREEN(signal_id)
Sets signal to green state.
- Parameters:
signal_id
-
HAL(haltype, params...)
Defines VPIN mapping for specific hardware drivers.
- Parameters:
haltype – driver name, normally device type
params... – depend on driver
-
HAL_IGNORE_DEFAULTS
System will ignore default HAL settings.
-
IF(sensor_id)
Checks sensor state, If false jumps to matching nested ELSE or ENDIF.
- Parameters:
sensor_id – VPIN of sensor. Negative VPIM will invert sensor state.
-
IFRANDOM(percent)
randomly satisfield IF at given percent probability
See also
- Parameters:
percent
-
IFTHROWN(turnout_id)
Checks if given turnout is in THROWN state.
See also
- Parameters:
turnout_id
-
IFRESERVE(block)
Agttempts to reserve block token and if satisfiled the block remains reserved.
See also
- Parameters:
block
-
IFTTPOSITION(turntable_id, position)
Checks if GTurntable is in given position.
See also
- Parameters:
turntable_id
position
-
IFRE(sensor_id, value)
????????????????????????????????????????
- Parameters:
sensor_id
value
-
INVERT_DIRECTION
Marks current task so that FWD and REV commands are inverted.
-
JMRI_SENSOR(vpin, count...)
DEfines multiple JMRI
- Parameters:
vpin
count... – Number of consecutine VPINS for which to create JMRI sensor feedbacks. Default 1.
-
JOIN
Switches PROG track to receive MAIN track DCC packets. (Drive on PROG track)
-
KILLALL
Tertminates all running EXRAIL tasks.
-
LATCH(sensor_id)
Make all AT/AFTER/IF see sensor active without checking hardware.
- Parameters:
sensor_id – Must only be for VPINS 0..255
-
LCC(eventid)
Issue event to LCC.
- Parameters:
eventid
-
LCCX(senderid, eventid)
Issue LCC event while impersonating another sender.
- Parameters:
senderid
eventid
-
LCD(row, msg)
Write message on row of default configured LCD/OLED.
See also
- Parameters:
row
msg – Quoted text
-
SCREEN(display, row, msg)
Send message to external display hadlers.
- Parameters:
display – number, 0=local display, others are handled by external displays which may have different display numbers on different devices.
row
msg – Quoted text
-
LCN(msg)
??????
- Parameters:
msg
-
MESSAGE(msg)
Send a human readable message to all throttle users.
- Parameters:
msg – Quoted text
-
MOVETT(id, steps, activity)
???????????????????
- Parameters:
id
steps
activity
-
NEOPIXEL(id, r, g, b, count...)
Set a NEOPIXEL vpin to a given red/green/blue colour.
- Parameters:
id – VPIN of a pixel
r – red component 0-255
g – green component 0-255
b – blue component 0-255
count... – Number of consecutive pixels to set, Default 1.
-
NEOPIXEL_SIGNAL(sigid, redcolour, ambercolour, greencolour)
Define a signal that uses a single multi colour pixel.
- Parameters:
sigid – unique signal id
redcolour – RGB colour
ambercolour
greencolour – Use NeoRGB(red,green,blue) to create values for redcolour etc above.
-
ACON(eventid)
Send MERG CBUS ACON to Adapter.
- Parameters:
eventid
-
ACOF(eventid)
Send MERG CBUS ACOF to Adapter.
- Parameters:
eventid
-
ONACON(eventid)
Start task here when ACON for event receied from MERG CBUS.
- Parameters:
eventid
-
ONACOF(eventid)
Start task here when ACOF for event receied from MERG CBUS.
- Parameters:
eventid
-
ONACTIVATE(addr, subaddr)
Start task here when DCC Activate sent for short address.
- Parameters:
addr
subaddr
-
ONACTIVATEL(linear)
Start task here when DCC Activate sent for long address.
- Parameters:
linear
-
ONAMBER(signal_id)
Start task here when signal set to AMBER state.
- Parameters:
signal_id
-
ONTIME(value)
Start task here when fastclock mins in day=value.
- Parameters:
value
-
ONCLOCKTIME(hours, mins)
Start task here when fastclock matches time.
- Parameters:
hours
mins
-
ONCLOCKMINS(mins)
Start task here hourly when fastclock minutes matches.
- Parameters:
mins
-
ONOVERLOAD(track_id)
Start task here when given track goes into overload.
- Parameters:
track_id – A..H
-
ONDEACTIVATE(addr, subaddr)
Start task here when DCC deactivate packet sent.
- Parameters:
addr
subaddr
-
ONDEACTIVATEL(linear)
Start task here when DCC deactivate sent to linear address.
- Parameters:
linear
-
ONCLOSE(turnout_id)
Start task here when turnout closed.
- Parameters:
turnout_id
-
ONLCC(sender, event)
??????????????????
- Parameters:
sender
event
-
ONGREEN(signal_id)
Start task here when signal set to GREEN state.
- Parameters:
signal_id
-
ONRED(signal_id)
Start task here when signal set to RED state.
- Parameters:
signal_id
-
ONROTATE(turntable_id)
Start task here when turntable is rotated.
- Parameters:
turntable_id
-
ONTHROW(turnout_id)
Start task here when turnout is Thrown.
- Parameters:
turnout_id
-
ONCHANGE(sensor_id)
???????????????????
- Parameters:
sensor_id
-
ONSENSOR(sensor_id)
Start task here when sensor changes state (debounced)
- Parameters:
sensor_id
-
ONBUTTON(sensor_id)
Start task here when sensor changes HIGH to LOW.
- Parameters:
sensor_id
-
PAUSE
Pauses all EXRAIL tasks except the curremnt one. Other tasks ESTOP their locos until RESUME issued.
-
PIN_TURNOUT(id, pin, description...)
Defines a tirnout which operates on a signle pin.
- Parameters:
id
pin
description... – Quoted text (shown to throttles) or HIDDEN
-
PRINT(msg)
prints diagnostic message on USB serial
- Parameters:
msg – Quoted text
-
PARSE(msg)
Executes <> command as if entered from serial.
- Parameters:
msg – Quoted text, preferably including <>
-
PICKUP_STASH(id)
Loads stashed value into current task loco.
- Parameters:
id – position in stash where a loco id was previously saved.
-
POM(cv, value)
Write value to cv on current tasks loco (Program on Main)
- Parameters:
cv
value
-
POWEROFF
Powers off all tracks.
-
POWERON
Powers ON all tracks.
-
READ_LOCO
Reads loco Id from prog traqck and sets currenmt task loco id.
-
RED(signal_id)
sets signal to RED state
- Parameters:
signal_id
-
RESERVE(blockid)
Waits for token for block. If not available immediately, current task loco is stopped.
- Parameters:
blockid
-
RESET(pin, count...)
Sets output puin LOW.
- Parameters:
pin
count... – Number of consecutive pins, default 1
-
REV(speed)
Issues DCC speed packet for current loco in reverse.
See also
- Parameters:
speed – (0..127, 1=ESTOP)
-
ROTATE(turntable_id, position, activity)
????
- Parameters:
turntable_id
position
activity
-
ROTATE_DCC(turntable_id, position)
????
- Parameters:
turntable_id
position
-
ROSTER(cab, name, funcmap...)
Describes a loco roster entry visible to throttles.
- Parameters:
cab – loco DCC address or 0 for default entry
name – Quoted text
funcmap... – Quoted text, optional list of function names separated by / character with momentary fuinctin names prefixed with an *.
-
ROUTE(id, description)
DEfines starting point of a sequence that will appear as a route on throttle buttons.
- Parameters:
id
description – Quoted text, throttle button capotion.
-
ROUTE_ACTIVE(id)
Tells throttle to display the route button as active.
- Parameters:
id
-
ROUTE_INACTIVE(id)
Tells throttle to display the route button as inactive.
- Parameters:
id
-
ROUTE_HIDDEN(id)
Tells throttle to hide the route button.
- Parameters:
id
-
ROUTE_DISABLED(id)
Tells throttle to display the route button as disabled.
- Parameters:
id
-
ROUTE_CAPTION(id, caption)
Tells throttle to change thr route button caption.
- Parameters:
id
caption
-
SENDLOCO(cab, route)
Start a new task to drive the loco.
- Parameters:
cab – loco to be driven
route – id of route/automation or sequence to drive
-
SEQUENCE(id)
Provides a unique label than can be used to call, follow or start.
See also
See also
See also
- Parameters:
id
-
SERIAL(msg)
Write direct to Serial output.
- Parameters:
msg – Quoted text
-
SERIAL1(msg)
Write direct to Serial1 output.
- Parameters:
msg – Quoted text
-
SERIAL2(msg)
Write direct to Serial2 output.
- Parameters:
msg – Quoted text
-
SERIAL3(msg)
Write direct to Serial3 output.
- Parameters:
msg – Quoted text
-
SERIAL4(msg)
Write direct to Serial4 output.
- Parameters:
msg – Quoted text
-
SERIAL5(msg)
Write direct to Serial5 output.
- Parameters:
msg – Quoted text
-
SERIAL6(msg)
Write direct to Serial6 output.
- Parameters:
msg – Quoted text
-
SERVO(id, position, profile)
Move servo to given position.
- Parameters:
id – VPIN of servo
position
profile – ?????????? names ???????????
-
SERVO2(id, position, duration)
Move servo to given position taking time.
- Parameters:
id
position
duration – mS
-
SERVO_SIGNAL(vpin, redpos, amberpos, greenpos)
Dedfine a servo based signal with 3 servo positions.
- Parameters:
vpin
redpos
amberpos
greenpos
-
SERVO_TURNOUT(id, pin, activeAngle, inactiveAngle, profile, description...)
Define a servo driven turnout.
- Parameters:
id – used by THROW/CLOSE
pin – VPIN for servo
activeAngle
inactiveAngle
profile – ??????
description... – Quoted text shown to throttles or HIDDEN keyword to hide turnout button
-
SET(pin, count...)
Set VPIN HIGH
- Parameters:
pin
count... – Number of sequential vpins to set. Default 1.
-
SET_TRACK(track, mode)
Set output track type.
- Parameters:
track – A..H
mode – ???names???
-
SET_POWER(track, onoff)
Set track power mode.
- Parameters:
track – A..H
onoff – ??? values ???
-
SETLOCO(loco)
Sets the loco being handled by the current task.
- Parameters:
loco
-
SETFREQ(freq)
Sets the DC track PWM frequency.
- Parameters:
freq – ??????????? values ??????
-
SIGNAL(redpin, amberpin, greenpin)
Define a Signal with LOW=on leds (is that common annode???)
See also
- Parameters:
redpin
amberpin
greenpin
-
SIGNALH(redpin, amberpin, greenpin)
define a signal with HIGH=ON leds
- Parameters:
redpin
amberpin
greenpin
-
SPEED(speed)
Changes current tasks loco speed without changing direction.
- Parameters:
speed – 0..127 (1=ESTOP)
-
START(route)
Starts a new task at the given route/animation/sequence.
- Parameters:
route
-
STASH(id)
saves cuttent tasks loco id in the stash array
- Parameters:
id
-
STEALTH(code...)
Allows for embedding raw C++ code in context of current task.
- Parameters:
code...
-
STEALTH_GLOBAL(code...)
Allows for embedding raw c++ code out of context.
- Parameters:
code...
-
THROW(id)
Throws given turnout.
- Parameters:
id
-
TOGGLE_TURNOUT(id)
Toggles given turnout.
- Parameters:
id
-
TT_ADDPOSITION(turntable_id, position, value, angle, description...)
Defines a turntable track position.
- Parameters:
turntable_id
position – ??????????
value
angle
description...
-
TURNOUT(id, addr, subaddr, description...)
Defines a DCC accessory turnout with legacy address.
- Parameters:
id
addr
subaddr
description... – Quoted text or HIDDEN, appears on throttle buttons
-
TURNOUTL(id, addr, description...)
Defines a DCC accessory turnout with inear address.
param id
- Param :
- Parameters:
addr
description...
-
VIRTUAL_SIGNAL(id)
Defines a virtual (no hardware) signal.
- Parameters:
id
-
VIRTUAL_TURNOUT(id, description...)
Defines a virtual (no hardware) turnout.
- Parameters:
id
description...
-
WAITFOR(pin)
???????????????????
- Parameters:
pin
-
WAITFORTT(turntable_id)
- Parameters:
turntable_id
-
WITHROTTLE(msg)
Broadcasts a string in Withrottle protocol format to all throttles using this protocol.
- Parameters:
msg
-
XFOFF(cab, func)
Turns function off for given loco.
- Parameters:
cab
func
-
XFON(cab, func)
Turns function ON for given loco.
- Parameters:
cab
func
-
XFTOGGLE(cab, func)
Toggles function state for given loco.
- Parameters:
cab
func
-
XFWD(cab, speed)
Sends DCC speed to loco in forward direction.
- Parameters:
cab
speed – (0..127, 1=ESTOP)
-
XREV(cab, speed)
Sends DCC speed to loco in reverse direction.
- Parameters:
cab
speed – (0..127, 1=ESTOP)