Restore original workplace number at the end of a macro?


  • administrators

    Currently, when you run a macro (or use the M120/M121 push/pop commands), certain values (e.g. feed rate) are saved at the start and restored at the end. Currently this does not include the current workplace number.

    Do you think the current workplace number (selected by G54, G55 etc.) should be saved and restored too? On the plus side, you would be able to reserve certain workplace coordinate numbers for use by particular macros, knowing that at the end of the macro you would be back in the original workplace number. On the minus side, you would not be able to have a macro that switches to a different workplace number and leaves the system in that workplace when you exit the macro.



  • Subroutines and Macros are not mentioned in the NIST G-Code standard, so no help there. Quite a few manufactures added M codes or G96 to achieve either subroutines or macros (with arguments) and returns. Nesting is allowed.

    To my knowledge, none of the proprietary M or G codes push/pop anything.

    .

    My personal feeling is that NOTHING should be pushed/popped "automatically" in a macro. M120/M121 can (could) be used in macros if that behavior is desired.

    To be clear, I'm not advocating changing existing behavior, too much of an install base... although, if you'd even consider that (non-upward-compatible) change, I believe it would improve the long term health of Duet/RepRap.

    Anyway, based on the de-facto handling in manufacturers extensions, and on my personal philosophy, I'd vote no to auto-push/pop of coordinate system number.



  • I'm on the same wavelength with Danal on this one! Unless specifically instructed through M120/M121, nothing should be saved/restored by default for maximum flexibility.

    Of course, workplace related settings should be included in the push/pop support as some of the workplace settings might be temporarily changed for the needs of the macro.


Log in to reply