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

    SBC bug? Scope rules for while construct in macros?

    Scheduled Pinned Locked Moved
    Gcode meta commands
    rrf3
    3
    4
    318
    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.
    • Gixxerfastundefined
      Gixxerfast
      last edited by Gixxerfast

      Hi!
      There seem to be different scope rules for the while construct dependig if you run them in standalone or sbc.

      We both run RRF ver 3.3

      This test snippet just tries to declare a local variable inside the loop scope (it's just an example):

      var count = 0
      
      while var.count < 3
      
        echo "Hello world. Count:  ", {var.count}
        
        var param = 42
        echo "Param: ", {var.param}
        
        set var.count = {var.count + 1}  
      ;end while
      

      Result in a standalone setup:

      2021-10-06 19:03:03	M98 P"0:/macros/test/looptest.g"
      Hello world. Count:   0
      Param:  42
      Hello world. Count:   1
      Param:  42
      Hello world. Count:   2
      Param:  42
      

      Result in an SBC:

      10/6/2021, 1:13:48 PM    M98 P"0:/macros/looptest.g"
      Hello world. Count:   0
      Param:  42
      Hello world. Count:   1
      10/6/2021, 1:13:48 PM    Error: variable 'var.param' already exists of looptest.g
      

      Is this known behavior? How is it suppose to work?

      Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
      Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
      Ender 3 Pro with BTT SKR-2 + RRF

      Gixxerfastundefined T3P3Tonyundefined 2 Replies Last reply Reply Quote 1
      • Gixxerfastundefined
        Gixxerfast @Gixxerfast
        last edited by Gixxerfast

        Are local variables at all meant to be supported in SBC mode in V3.3

        d2d4880b-574c-4f21-ab91-cf76ae860ef7-image.png

        Voron V2.4 (#1317) with Duet 3 Mini5+ Wifi and 1LC v1.1 Toolboard
        Voron V0.1 (#637) with Duet 3 Mini 5+ Wifi and 1LC v1.2 Toolboard
        Ender 3 Pro with BTT SKR-2 + RRF

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

          @gixxerfast thanks for reporting this. I have confirmed I see the same issue and have let @chrishamm know.

          www.duet3d.com

          1 Reply Last reply Reply Quote 2
          • chrishammundefined
            chrishamm administrators
            last edited by

            @gixxerfast Thanks for reporting this, I've prepared a bug fix for the upcoming software version 3.4-b5.

            Duet software engineer

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