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

    Setting global variable positions... pls god help

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    4
    252
    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.
    • Merlin246undefined
      Merlin246
      last edited by

      Hello,

      I am struggling to create global variables for various positions (my application is for the locations for tool pickup/dropoff for an E3D Toolchanger).

      Ideally it would be set so when called it would be:

      G1 X{T1_ready[0]} Y{T1_ready[1]}
      

      or similar if T1 is reserved for the tool command. However I cannot seem to actually initialize an array. I have tried:

      global T1_ready = {81.5, 210}
      

      but keep getting the error:
      b15c0481-5c9c-445b-be0c-73efd99b46e0-image.png
      set global t1_ready = {1, 2}
      Error: meta command: expected a global or local variable

      I have tried adding braces to various parts of the command (after the variable declaration, etc). I should note that there is currently no variable with the name t1_ready.

      I have also tried using the precursor "set" but that throws this error:
      1e32780b-36fb-4f20-8468-b308104aa2c6-image.png

      So then I tried:

      global t1_ready = null;
      set global.t1_ready = {1,2};
      

      which produces this error:
      632ce269-b0b7-4a8e-974f-58744cb5ef7c-image.png

      What am I doing wrong?

      PS: It seems like the documentation is not clear enough on this, some more examples would go a long way for this. Also note that the example in "Global Variable Decleration" is incorrect as it uses

      set global.T1heat=0
      

      instead of just:

      global  T1heat = 0
      

      This may be a poor example as I think T1heat is already a default global variable. Maybe change the name to something that's not an automatic default?

      droftartsundefined 1 Reply Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @Merlin246
        last edited by

        @Merlin246 What version of RepRapFirmware are you using? Arrays have only been supported since RRF 3.5b1.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        Merlin246undefined 1 Reply Last reply Reply Quote 0
        • Merlin246undefined
          Merlin246 @droftarts
          last edited by

          @droftarts ahhhh ok that explains it. I'm on 3.4.3.

          In the meantime just set single value variables? such as:

          global t1_ready_X = 81.5
          global t1_ready_y = 210
          

          Is there a way to denote using periods instead? Syntax would be t1.ready.X, t1.pick.X, t1.ready.speed, t1.pick.speed, for example (it would be the class of positions, speeds etc for the tool).

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

            @Merlin246 said in Setting global variable positions... pls god help:

            Is there a way to denote using periods instead?

            No.

            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 0
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA