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

    Passing Multiple Rod Lengths through M665

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    7
    362
    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.
    • lord binkyundefined
      lord binky
      last edited by lord binky

      I'm just wonder how (if it's even possible) to pass variables for the separate arm lengths that's possible with the normal uses of M665 (ex: M665 L260.1:260.2:260.0 ) which works fine without a variable in the macro. I have varying arm lengths (with a mm but getting them right puts my calibrations under .015 mm and wrote meta macro to iterate through rod lengths at .001 mm increments to see if I can get it better (mostly for shits and giggles, not at all number chasing for under .005 deviation). But even when I successfully pass the command, it always writes it as a uniform arm length. So I'm just asking if I'm attempting the impossible or if someone knows the trick for this command.
      example where Echo will work but M665 would not

      echo "M665 L"^ {move.kinematics.towers[0].diagonal+0.05} ^ ":" ^ move.kinematics.towers[1].diagonal ^ ":" ^ move.kinematics.towers[2].diagonal 
      M665 "L" ^ {move.kinematics.towers[0].diagonal+0.05} ^ ":" ^ move.kinematics.towers[1].diagonal ^ ":" ^move.kinematics.towers[2].diagonal
      
      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @lord binky
        last edited by OwenD

        @lord-binky
        Try removing the double quotes.
        echo expects a string (requires quotes). M665 is expecting an array of numbers.

        var amount=0.05
        M665 L{move.kinematics.towers[0].diagonal + var.amount}:{move.kinematics.towers[1].diagonal}:{move.kinematics.towers[2].diagonal}
        
        dc42undefined 1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @OwenD
          last edited by

          @lord-binky it's possible in RRF 3.3 in standalone mode only, using the syntax that @OwenD suggests. In 3.4beta it's possible both in standalone mode and in SBC mode, but the syntax has changed and is now:

          var amount=0.05
          M665 L{move.kinematics.towers[0].diagonal + var.amount,move.kinematics.towers[1].diagonal,move.kinematics.towers[2].diagonal}
          

          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

          lord binkyundefined 1 Reply Last reply Reply Quote 0
          • lord binkyundefined
            lord binky @dc42
            last edited by

            @OwenD @dc42 Thank you very much! I may have facepalmed after seeing how I overcomplicated that.

            1 Reply Last reply Reply Quote 0
            • lord binkyundefined
              lord binky
              last edited by lord binky

              ~@dc42 @OwenD Ok so an additional expression {} so this line actually works but also returns this.

               var amount=0.05
              M665 L{{move.kinematics.towers[0].diagonal + var.amount}:{move.kinematics.towers[1].diagonal}:{move.kinematics.towers[2].diagonal}}
              
              test 1
              M665 L361.150:361.200:361.300
              Error: in file macro line 22 column 57: M665: Expected '}'
              Diagonals 361.150:361.200:361.300, delta radius 143.059, homed height 284.668, bed radius 180.0, X 0.472°, Y 0.088°, Z 0.000°
              

              Still, that works and I'm moving on. Thanks again.

              Since it might be bug or I might be the bug, I went ahead and attached my macro if you want to check it out yourself ( or more likely point out something else I missed / over complicated).
              I added the .g so the file would upload, didn't want to zip it because they feel shady to me? So, you probably have to remove it to run it right 🤷
              M665 Macro Test.g

              Edit: Ok I was wrong again, but on the right track no error messages now and thoroughly tested in test macro after cluttering my one in development with echo's...so many echos... 😱
              Anyways, the winner is classic array punctuation: the mighty comma. It passes along fine inside expression curly parenthesis.
              {{ expression },{ expression }}
              ex:

               var amount=0.05
              M665 L{{move.kinematics.towers[0].diagonal + var.amount},{move.kinematics.towers[1].diagonal},{move.kinematics.towers[2].diagonal}}
              
              OwenDundefined 1 Reply Last reply Reply Quote 0
              • OwenDundefined
                OwenD @lord binky
                last edited by

                @lord-binky said in Passing Multiple Rod Lengths through M665:

                M665 L{{move.kinematics.towers[0].diagonal + var.amount},{move.kinematics.towers[1].diagonal},{move.kinematics.towers[2].diagonal}}

                as @DC42 mentioned, M665 uses a comma from version 3.4beta.
                The docs don't mention that yet.
                I believe your outside parenthesis are superfluous and are the cause of your earlier error.
                i.e. You are trying to evaluate the entire command instead of just the variables.

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

                  @owend it's the inner parentheses that are redundant.

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