Difference between revisions of "Macro use and format"

From AllStarLink Wiki
Jump to navigation Jump to search
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==What is a 'macro'?==
 
==What is a 'macro'?==
  
The purpose of a macro is to store normal command(s) to be called by direct command, or by the system scheduler. Or, even by a external script.
+
The purpose of a macro is to store normal command(s). Macros may be called by direct command, [https://wiki.allstarlink.org/wiki/Scheduler_(ASL_System)/ 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.
They can be a series of commands to make short work of a larger task.
 
  
===How to configure within a node===
+
==How to configure within a node==
[node#xxx] ;assigned node number
 
 
 
rxchannel = SimpleUSB/usb_node# ; Rx audio/signaling channel
 
  
 +
The first part of macro settings is the <code>macro=</code> setting. The example here points to a stanza named <code>[macro]</code>. This is likely already in your config.
 +
<pre>
 +
[12345]                            ; Assigned node number
 +
rxchannel = SimpleUSB/usb_node#   ; Rx audio/signaling channel
 
duplex=2
 
duplex=2
 
 
linktolink=no
 
linktolink=no
 
+
controlstates=controlstates       ; System control state list
controlstates=controlstates   ; system control state list
 
 
 
 
scheduler=scheduler
 
scheduler=scheduler
 
 
events=events
 
events=events
 
 
morse=morse
 
morse=morse
 
+
macro=macro                       ; <===== note this in your rpt.conf
'''macro=macro'''
 
 
 
 
tonemacro=tonemacro
 
tonemacro=tonemacro
 
 
functions=functions
 
functions=functions
 
 
phone_functions=phone_functions
 
phone_functions=phone_functions
 
 
link_functions=link_functions
 
link_functions=link_functions
 
 
wait_times=wait_times
 
wait_times=wait_times
 
 
telemetry=telemetry
 
telemetry=telemetry
 +
</pre>
  
 +
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...
  
If you have more than one node on a given server and you want all you nodes to have the same macros then the above macro=macro is fine. But to make a separate macro list for a specific node...
+
<code>macro=macro12345</code> - where 12345 could be your node number for clarity. And would correspond with macro later in the file as...
 
 
'''macro=macro12345''' - where 12345 could be your node number for clarity.
 
 
 
And would correspond with macro later in the file as
 
 
 
'''[macro12345]'''
 
  
 +
<pre>
 +
[macro12345]
 
1=*81 ;Play time
 
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
 +
</pre>
  
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.
 
 
 
 
It is likely better to use universal format of macro=macro and have it shared by all nodes. But listed here in the case you need separation.
 
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==
 
==Execution==

Revision as of 12:56, 4 July 2022

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
macro=macro                       ; <===== 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.