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

    var with the same name as a param

    Scheduled Pinned Locked Moved
    Gcode meta commands
    2
    4
    154
    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.
    • DonStaufferundefined
      DonStauffer
      last edited by

      If I call this macro:

      var G = null
      if exists(param.L)
          set var.G = param.L
      
      var L = 1
      

      using M98 there is no error, unless I include an L parameter, like L"TestParam", in which case the last line gets flagged as an error:

      Error: in file macro line 5 column 8: meta command: variable 'L' already exists

      I didn't expect this, since I assumed param.L would be different from var.L, and also, because global.L coexists fine with var.L. It also seems like global.L coexists fine with param.L.

      Is it difficult to just make global.L, var.L and param.L 3 separate entities? It might be useful to document how this works once it's settled.

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @DonStauffer
        last edited by

        @DonStauffer are you running in standalone mode or with attached sBC?

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        DonStaufferundefined 1 Reply Last reply Reply Quote 0
        • DonStaufferundefined
          DonStauffer @dc42
          last edited by DonStauffer

          @dc42 Standalone. Railcore.

          dc42undefined 1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @DonStauffer
            last edited by

            @DonStauffer thanks for reporting this. It's not intended behaviour. I have created https://github.com/Duet3D/RepRapFirmware/issues/1003.

            dc42 created this issue in Duet3D/RepRapFirmware

            closed Bug: can't create a variable with the same name as a parameter #1003

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

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