Repeat a simple movement program indefinitely



  • I'm trying to write a quick Gcode to demonstrate the basic movement of my 3d printer. The movements are: home everything, then move around to the X Y axis limits at increasing speeds, then repeat. I want this to repeat indefinitely as this is going to just be a running demonstration.

    I've tried to loop the program with an M99 but it didn't do anything, I also tried a GOTO N100, with the N100 at the beginning of the program but that didn't work either,probably because GOTO will only look forward.

    Is there a way I can easily do this by repeating the code? What if I wrote 2 identical programs that called each other into an endless program nest. That seems like a bad idea.

    Any thoughts?



  • @mklein23 In thread https://forum.duet3d.com/topic/5039/macro-variables is confirmed that goto, loops etc. are not supported yet and why.
    As workaround you can write macros and run and nest them, e.g. one for homing and moving, the next one to call that macro 100 times and the third to run the second one 100 times - and so on. With M98 https://duet3d.dozuki.com/Wiki/Setting_up_macro_files_for_common_tasks#Section_Running_Macros

    Edit: maybe nesting more than 2 levels is not a good idea, as the needed stack may produce memory problems. So one macro for movements and one macro to call it, with thousands of calls to the movement macro.



  • Did you try calling your macro recursivelly?


Log in to reply