Subroutines group several commands under one alphanumeric name. If you keep sending the same group of commands, give it a name and call it when you need it. Start with o <name> sub and finish with o <name> endsub. To run those lines, send o <name> call.
o park sub
G0 Z20
G0 X0 Y0
M5
o park endsub
o park call
A space is required between o and the name. The name may contain letters or numbers.
| Command | Result |
|---|---|
o <name> sub |
Starts a definition and replaces an existing routine with the same name |
o <name> endsub |
Ends the active definition |
o <name> call |
Dispatches each stored line in order |
o <name> list |
Prints the stored lines; intended as a development aid |
o <name> save |
Writes the definition to <name>.sub in the current directory; intended as a development aid |
Smoothie stores definitions in RAM. They disappear on reset unless you save and load them from storage.
o park save creates park.sub with the sub and endsub lines included. After a reset, use the Player module (play) to read the file back into RAM, then call the routine when you need it. Playing the definition records its lines; it does not call the routine.
The save command overwrites a file of the same name in the current working directory. Use cd to choose the directory before saving.
CommandShell.cpp implements the O-word command subset.