Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Repeat a simple movement program indefinitely

    Duet Hardware and wiring
    3
    3
    535
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Mklein23
      Mklein23 last edited by

      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?

      JoergS5 1 Reply Last reply Reply Quote 0
      • JoergS5
        JoergS5 @Mklein23 last edited by JoergS5

        @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.

        1 Reply Last reply Reply Quote 0
        • fma
          fma last edited by

          Did you try calling your macro recursivelly?

          Frédéric

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA