Additional Machine State Variables in the Push/Pop Container



  • Duet has an awesome feature to snapshot the state of the machine, alter the machine state, and then restore it from the snapshot (M120 and M121: Push and Pop. It looks like only a subset of the machine state is captured though. Would it be possible to capture other motion-related state variables too, like those that specify acceleration values?

    Here's the use case: in a multitool setup, we can use the toolchange macros to alter the tool-less machine state when a particular tool is loaded. If it's a slightly heavier tool, we could reduce the acceleration values with M201. Upon releasing that tool, the prior acceleration values would be restored.



  • I came here to ask for the same feature, although where I'm coming from is to really aid the transportability of scripts, and allowing them to be "future-proofed" against changes to your configuration.

    For example, if I write a script which required changing the M558 A value to 5 for the duration of the script, currently I cannot reset it back to whatever the user had before at the end.
    If it was possible to push any object or value previously set, I could push that existing value onto a stack, make my changes (i.e. change M558 A to 5) and then pop it back when finished.

    For my own scripts, this is not an issue as I know what values I have set, but to be able to disseminate scripts to a community can be tricky - I may have no idea of what someone else's values are initially set at, and either have to write comments for people to change and keep updates in the script, or go for a logical/probable value within the community of my 3D printer.

    "Future-proofing" is similar, perhaps my script changes my maximum jerk and accel for the duration of the script and resets to my (current) values at the end. If I modify my config.g values at a later date, I need to update any scripts that "change and set back" these values.

    (loving RRF3 on the Duet2 BTW!)



  • I've just realised, I just need to wait for variables...

    Use object model to get value and assign to variable. Make changes/run script, and then use variable to assign the previous values.

    Nothing to see here! As you were! 🙂


Log in to reply