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

M572's D parameter doesn't process expressions

Scheduled Pinned Locked Moved
Gcode meta commands
3
8
490
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.
  • undefined
    garethky
    last edited by 8 Jan 2021, 06:04

    echo {state.currentTool}
    //Log: 3
    M572
    //Log: Extruder pressure advance: 0.010, 0.010, 0.010, 0.100
    M572 D{state.currentTool} S0.2
    M572 //Log: Extruder pressure advance: 0.010, 0.010, 0.010, 0.100

    I want to use this to set the pressure advance in a Filament config.g file for only the current tool being loaded.

    1 Reply Last reply Reply Quote 0
    • undefined
      dc42 administrators
      last edited by 8 Jan 2021, 07:32

      @garethky said in M572's D parameter doesn't process expressions:

      echo {state.currentTool} //Log: 3 M572 //Log: Extruder pressure advance: 0.010, 0.010, 0.010, 0.100 M572 D{state.currentTool} S0.2 M572 //Log: Extruder pressure advance: 0.010, 0.010, 0.010, 0.100

      It works for me:

      3
      Error: Bad command: //Log: 3
      Extruder pressure advance: 0.200, 0.200, 0.050, 0.050
      Error: Bad command: //Log:  Extruder pressure advance: 0.010, 0.010, 0.010, 0.100
      Extruder pressure advance: 0.200, 0.200, 0.050, 0.200
      Error: Bad command: M572 //Log:  Extruder pressure advance: 0.010, 0.010, 0.010, 0.100
      

      Tested on Duet 3 running RERF 3.2 in standalone mode.

      btw, command M572 D{state.currentTool} S0.2 is only correct if you have a 1:1 mapping between tool numbers and extruder numbers. Better would be M572 D{tools[state.currentTool].extruders[0]} S0.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 1
      • undefined
        garethky
        last edited by 8 Jan 2021, 08:24

        Does using the Pi/SBC make a difference?

        I'm running 3.2.0-rc2.

        undefined 1 Reply Last reply 8 Jan 2021, 23:16 Reply Quote 0
        • undefined
          dc42 administrators
          last edited by 8 Jan 2021, 08:34

          I will ask @chrishamm to take a look.

          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
          • undefined
            Phaedrux Moderator @garethky
            last edited by 8 Jan 2021, 23:16

            @garethky said in M572's D parameter doesn't process expressions:

            I'm running 3.2.0-rc2.

            Update to 3.2 final?

            Z-Bot CoreXY Build | Thingiverse Profile

            1 Reply Last reply Reply Quote 0
            • undefined
              dc42 administrators
              last edited by 9 Jan 2021, 07:59

              We have identified the problem. The M572 command D parameter is in general an array. DSF/RRF do not currently support array-valued expressions. RRF does allow individual array elements to be expressions, but DSF has no means to pass an array to RRF with expressions as the elements.

              We can fix the specific case of passing a single expression as an array quite easily, and this fix will be in the 3.3 release. Fixing the more general case where you need to pass an array expression with more than one element will take a little longer.

              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

              undefined 1 Reply Last reply 9 Jan 2021, 23:30 Reply Quote 1
              • undefined
                garethky @dc42
                last edited by 9 Jan 2021, 23:30

                @dc42 said in M572's D parameter doesn't process expressions:

                M572

                AHH! That makes sense, I was going to separately ask how that worked because I couldn't figure out the syntax for extruders:

                ; this doesn't work:
                M92 E{13.6 * 60}:{13.6 * 60}:{13.6 * 60}:{13.6 * 60}

                I'm guessing it would be something more like this, which is more complicated to evaluate as currently no expression can do array assignment:

                M92 E{[13.6 * 60, 13.6 * 60, 13.6 * 60, 13.6 * 60]}
                

                I really hope that when variables happen we will be able to declare arrays. I think this is a good case for including that.

                undefined 1 Reply Last reply 10 Jan 2021, 09:21 Reply Quote 0
                • undefined
                  dc42 administrators @garethky
                  last edited by 10 Jan 2021, 09:21

                  @garethky said in M572's D parameter doesn't process expressions:

                  @dc42 said in M572's D parameter doesn't process expressions:

                  M572

                  AHH! That makes sense, I was going to separately ask how that worked because I couldn't figure out the syntax for extruders:

                  ; this doesn't work:
                  M92 E{13.6 * 60}:{13.6 * 60}:{13.6 * 60}:{13.6 * 60}

                  I'm guessing it would be something more like this, which is more complicated to evaluate as currently no expression can do array assignment:

                  M92 E{[13.6 * 60, 13.6 * 60, 13.6 * 60, 13.6 * 60]}
                  

                  I really hope that when variables happen we will be able to declare arrays. I think this is a good case for including that.

                  Your first example should work in standalone mode, but won't work in SBC mode. Your second example (or something like it) is what we plan for release 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

                  1 Reply Last reply Reply Quote 1
                  7 out of 8
                  • First post
                    7/8
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA