Navigation

    Duet3D Logo

    Duet3D

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

    user array variables?

    Gcode meta commands
    8
    21
    507
    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.
    • Print3d
      Print3d last edited by Print3d

      I stumbled across the user variable section wiki that said variable declaration was implemented in RRF 3.3beta2:
      global <new-variable-name> = <expression>

      This would solve all of my data gathering issues because I could create a simple loop in daemon.g to spit out the data into to a text file with M118/M98 commands then reset the data array at each loop iteration. I cobbled together a test and have it working based on printer status but I really want to set up a user-defined array variable for ease of processing, plus I'm limited currently on how many sensor values I can send to a single test line. user-defined array solves this all but I can't find any examples online and when I tried writing the code myself, DWC kicks back a response saying it doesn't recognize the variable. When will user-defined variables be available for beta or am I missing something?

      OwenD 1 Reply Last reply Reply Quote 1
      • OwenD
        OwenD @Print3d last edited by

        @print3d
        Variables have been implemented.
        Arrays are not yet possible.
        You can create a pseudo array by creating a dummy tool and using the offset values

        paulg4h 1 Reply Last reply Reply Quote 2
        • paulg4h
          paulg4h @OwenD last edited by

          @owend @Print3d

          Since RRF 3.3beta2 there are arrays and objects supported:
          https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Types

          paulg4h 1 Reply Last reply Reply Quote 0
          • paulg4h
            paulg4h @paulg4h last edited by paulg4h

            @dc42 but there is no example how the array variable type could be used in scripts I found. Maybe you are so kind and add something in the wiki or here.

            Many thank's in advance!

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

              @paulg4h array-valued variables are not yet supported. This is under consideration for support in RRF 3.4.

              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

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

                @dc42 user declared arrays would be really helpful 🙂

                DonStauffer 1 Reply Last reply Reply Quote 0
                • Diamondback
                  Diamondback last edited by

                  My use case would be storing tool specific PA, DAA, retraction etc settings for easier access. Currently this looks like this:

                  M302 S220 R150			;Cold extrusion settings
                  
                  var retractionDistance = 0.6
                  var retractionSpeed = 2100
                  var pressureAdvance = 0
                  
                  if state.currentTool == 0
                  	if global.tool0NozzleSize == 0.25
                  		;set var.pressureAdvance = 0.11
                  	elif global.tool0NozzleSize == 0.4
                  		set var.pressureAdvance = 0.11
                  	elif global.tool0NozzleSIze == 0.8
                  		;set var.pressureAdvance = 0.11
                  elif state.currentTool == 1
                  	if global.tool1NozzleSize == 0.3
                  		;set var.pressureAdvance = 0.11
                  	elif global.tool1NozzleSize == 0.4
                  		set var.pressureAdvance = 0.11
                  elif state.currentTool == 2
                  	if global.tool2NozzleSize == 0.3
                  		;set var.pressureAdvance = 0.11
                  	elif global.tool2NozzleSize == 0.4
                  		set var.pressureAdvance = 0.11
                  elif state.currentTool == 3
                  	if global.tool3NozzleSize == 0.3
                  		;set var.pressureAdvance = 0.11
                  	elif global.tool3NozzleSize == 0.4
                  		set var.pressureAdvance = 0.11
                  	
                  if state.currentTool >= 0
                  	M207 S{var.retractionDistance} F{var.retractionSpeed} Z0.0	;firmware retraction settings for PETG
                  	M572 D{tools[state.currentTool].extruders[0]} S{var.pressureAdvance}
                  

                  This would be so much nicer with a lookup table like format.

                  fcwilt 1 Reply Last reply Reply Quote 0
                  • DonStauffer
                    DonStauffer @Diamondback last edited by

                    @diamondback Agreed. I'm working around the lack of arrays and it's complicating things a bit.

                    1 Reply Last reply Reply Quote 0
                    • fcwilt
                      fcwilt @Diamondback last edited by fcwilt

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • Diamondback
                        Diamondback last edited by

                        Any news on the feasibility of this? @dc42
                        Would still love to get support for this and clean up my tool/filament configuration by putting it all in a nice array instead of many many files distributed across /macros

                        Marcossf 1 Reply Last reply Reply Quote 0
                        • Marcossf
                          Marcossf @Diamondback last edited by

                          @dc42 @chrishamm

                          Any update about the implementation of this topic?

                          May the 3.4 stable version have this feature?

                          Thanks!

                          dc42 1 Reply Last reply Reply Quote 1
                          • dc42
                            dc42 administrators @Marcossf last edited by

                            @marcossf it's unlikely to be included in 3.4 stable.

                            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

                            Marcossf 1 Reply Last reply Reply Quote 2
                            • Marcossf
                              Marcossf @dc42 last edited by

                              @dc42 Thanks David.

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

                                @dc42 Seeing that there is some work happening on this topic, are there likely gonna be hardware restrictions to user arrays? (Like only being available on Duet 3 hardware etc)
                                If so, I'd like to know early, I'd happily switch to 3 hardware just for this one feature alone 😄

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

                                  @diamondback current plans are to include support for array variables in RRF 3.5 for Duet 2, but to remove some of the kinematics options from the standard build, for example Rotary Delta and Hangprinter.

                                  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

                                  Diamondback 2 Replies Last reply Reply Quote 1
                                  • Diamondback
                                    Diamondback @dc42 last edited by

                                    @dc42 Many thanks, your awesome work keeps taking away my arguments to finally switch to Duet 3 hardware 😄

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

                                      @dc42 Just out of interest, will nested arrays be possible? Not strictly needed for my use case, but would certainly further clean up the meta gcode.

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

                                        @diamondback yes.

                                        f602bc06-1d72-4390-bc35-2a88b4db5341-image.png

                                        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

                                        Diamondback OwenD 2 Replies Last reply Reply Quote 3
                                        • Diamondback
                                          Diamondback @dc42 last edited by

                                          @dc42 🎊 Awesome!

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

                                            @dc42
                                            That's very cool 😎
                                            May be too early for details, but...
                                            Out of interest, how would one address the individual values of the multi dimensional array?

                                            {MyArray[3[2]]} ?

                                            while iterations < {#MyArray[3]}
                                            echo {MyArray[3[iterations]]}

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

                                              @owend it would be: MyArray[3][2]

                                              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