Problem with 'Restart Sript at Subroutine' command


when using the ‘Restart Script at Subroutine’ command it seems that the stack is cleared before the script is started. The manual doesn’t state this explicitly but that’s the behaviour of the ‘Restart Script’ button in the control application and that’s what I observe. Product is Mini Maestro 12.

For scripts needing more than one parameter I wrote a script that just contains a quit command like:
sub putValue

So I thought I would call this script with a parameter via ‘Restart Script at Subroutine with Parameter’ and repeat this until I have all necessary parameters on the stack. Then start the script which needs the parameters.

This doesn’t work because each subsequent invocation clears the previously put parameter from the stack.

What I really want to achieve is starting a script which leaves several values on the stack and at an arbitrary later time retrieves the results via another script. Think of data logging. This also is prevented by the fact that a script invocation via the serial protocol clears the stack before starting the script.

So my question is:
Is there a way to invoke a script on the maestro which leaves the stack as it was before starting the script?



Hello, Herbert.

Unfortunately, that kind of feature is not currently supported by the Maestro. You might consider translating the commands in your subroutine into the corresponding serial servo commands and sending them to the Maestro form another controller instead of using a Maestro script. That way you might be able to store values using an array or set of variables instead of the stack on the Maestro.


Hi Brandon,

thanks for replying. Saves me further searching. Not sure if I understand you correctly, but at least from your reply I got the idea that I can store another parameter in a spare servo channel and have the script read it from there :-)).

On the other hand (my second question) there must be a way to get the stack via USB (not serial as I asked for). The Maestro control center does it all the time. I can put one value on the stack, fire up the contol center and see that value.

Is that an undisclosed feature or is there a place where this is documented? Plain C would be most welcome, I want to use Raspbian and Smalltalk (the programming language).



You can read values from the stack over native USB using methods from our Software Development Kit (SDK). The code there serves as our main documentation of the Maestro’s USB interface. To get the values on the stack, you can use the overload of getVariables whose C# definition is public void getVariables(out short[] stack).

You could also run UscCmd --status and parse the output of that; this might be easier since you are not using a .NET language, so you won’t be able to directly call the USB SDK code.


Thanks Brandon,

after I looked into the UscCmd source (which I will have to compile to run on Rapberry Pi), I decided to use one servo channel as a two way communication port. So I will only have to deal with the serial port.

I can set and read values between 256 and 16320 which will give me plenty of command bits besides the 0 to 1023 parameter range.

But I’ve stored the idea to use UscCmd and parse its output for later use.