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

    Possible to pass variable to custom m-codes?

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    3
    210
    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.
    • rymndundefined
      rymnd
      last edited by

      I have been having issues passing variables to custom m-codes. Is that possible via DSF, or is that a fundamental limitation? When I try running the following macro and pass in any parameter, the DSF side shows the variable L as the string "{param.L}" instead of whatever value I try to assign.

      Wrapper macro file:

      if exists(param.L)
        M1234 L{param.L}
      else
        M1234
      

      Currently using RRF 3.4.5 and testing with the basic custom m-code example from the dsf-python repository

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

        @rymnd I think this is one for @chrishamm to look at.

        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
        • chrishammundefined
          chrishamm administrators
          last edited by

          @rymnd That's expected in v3.4 and earlier. You need to check if the parameter is an expression (I think there is a parameter property for that) and evaluate it using the EvaluateExpression command if it is. @Falcounet may help with the Python specifics.

          Duet software engineer

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