Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    SBC: Delay when nesting macros too 'deep'

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    2
    4
    121
    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.
    • reroundefined
      rero
      last edited by rero

      Good evening,

      following situation with a Duet6HC-Board in SBC-Mode connected to a RPI 5 (FW/DSF v3.5.4):

      When I run tool-change macros and reach a certain depth of nested macros, I get a delay of ~4 secs after executing the 'deepest'/innermost macro.

      The macro-calls look like this:

      Any tool command via console (or NC file):
      -> tfree_1.g
      -> tool_free.g (my generic tool-command)
      -> system_vars.g (set/updates a bunch of global variables)
      -> special_system_var.g (set a single global variable)

      When I execute special_system_var.g the system pauses for some seconds. From the log I can estimate the delay: ~4 seconds.

      I doesn't matter if this macro contains any code; even if it's empty the pause occurs.

      If I remove this macro(-level) and replace the M98-call with the macro-content everything works as expected.

      I checked if this is a generic issue with nested macros: I called up to 6 nested macros without an issue. I also tested these macros (just some echo-stuff and the M98 for the next level) within a system tool-change-macro and also no problem.
      So the issue is related to the nesting-depth and my concrete tool-macros.

      I can easily find a workaround for this, but it should be helpful to understand what happens here.

      Anyone any idea?

      Thanks and regards,
      Reiner

      T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined
        T3P3Tony administrators @rero
        last edited by T3P3Tony

        @rero i did a quick check with a 4 depth nested macro in SBC mode on 3.6beta4

        The macros were simple:

        echo "layer 1 start:"^state.time
        M98 P"0:/macros/nested depth check/layer2.g[layer1.g](/assets/uploads/files/1739719605905-layer1.g) [layer2.g](/assets/uploads/files/1739719605988-layer2.g) [layer3.g](/assets/uploads/files/1739719606040-layer3.g) [layer4.g](/assets/uploads/files/1739719606079-layer4.g) "
        echo "layer 1 end:"^state.time
        

        with the last depth just being the time echo, not calling any deeper

        the results:

        16/02/2025, 15:13:43	layer 1 end:2025-02-16T15:13:29
        16/02/2025, 15:13:43	layer 2 end:2025-02-16T15:13:28
        16/02/2025, 15:13:42	layer 3 end:2025-02-16T15:13:28
        16/02/2025, 15:13:42	layer 4 end:2025-02-16T15:13:28
        16/02/2025, 15:13:42	layer 4 start:2025-02-16T15:13:28
        16/02/2025, 15:13:42	layer 3 start:2025-02-16T15:13:28
        16/02/2025, 15:13:42	layer 2 start:2025-02-16T15:13:28
        16/02/2025, 15:13:42	layer 1 start:2025-02-16T15:13:28
        

        so this may be specific to tool change/more complex macros or it could be something that fixes in 3.6 Please can you try the simple macros or the type above. Also please try your tool change macros with 3.6beta4.

        layer1.g layer2.g layer3.g layer4.g

        www.duet3d.com

        reroundefined 1 Reply Last reply Reply Quote 0
        • reroundefined
          rero @T3P3Tony
          last edited by

          @T3P3Tony thanks for your response and check.

          I will test this when I am back in front of the machine next week. Just ordered some fast SD-cards. so I can upgrade without any fear to break something 😉

          I will also try to execute the tool-macro(s) manually instead of being called through the implicit tpre/tpost/tfree-mechanism ...

          Thx && have a good evening!

          reroundefined 1 Reply Last reply Reply Quote 0
          • reroundefined
            rero @rero
            last edited by

            A quick update: did a test with my concrete macros on 3.6beta4 and the same delay/pause occured.

            Need to fiddle around more with the code to understand which combination/code-part actually is causing the delay. More to test ... 😉

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