Macro use and format

From AllStarLink Wiki
Jump to navigation Jump to search

What is a 'macro'?

The purpose of a macro is to store normal command(s). Macros may be called by direct command, by the system scheduler, or even by an external script. They can be a series of commands to make short work of a larger task.

How to configure within a node

The first part of macro settings is the macro= setting. The example here points to a stanza named [macro]. This is likely already in your config.

[12345]                            ; Assigned node number
rxchannel = SimpleUSB/usb_node#	   ; Rx audio/signaling channel
duplex=2
linktolink=no
controlstates=controlstates        ; System control state list
scheduler=scheduler
events=events
morse=morse
<b>macro=macro</b>                        ; <===== note this in your rpt.conf
tonemacro=tonemacro
functions=functions
phone_functions=phone_functions
link_functions=link_functions
wait_times=wait_times
telemetry=telemetry

If you have more than one node on a given server and you want all nodes to have the same macros then the above macro=macro is fine. However you may want your nodes to have separate set of macros. In that case you need a separation for a specific node. For example...

macro=macro12345 - where 12345 could be your node number for clarity. And would correspond with macro later in the file as...

[macro12345]
1=*81 ;Play time
2=*81 *31999 *937 P P *995#      ; say time, connect node, play net announcement, pause, and turn off telemetry for net

Each macro command string is on the same line separated by a space and ends the string with a # (hashtag). A "P" can be used to cause a pause of 500ms or a series of them for more. This would allow time of a script or connection to execute before the next command is issued. The system reads/executes them left to right when called. You should test them after creating them to be sure timing has no interference before you actually need to use them. And note that use of our macro #2 might possibly also require us to create a new one to 'undo' any of our changes. Which in this case might be manually called at the end of the purposed example net.

Execution

Macro's are called with a *5 (star 5) prefix and followed with the number assigned in the [macro] stanza You can also call them from the system schedular by number. Calling a macro # is the only method the scheduler supports. So if you wish to schedule with the system scheduler, you need a macro to execute it.