Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login
    1. Home
    2. rymnd
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    rymnd

    @rymnd

    0
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    rymnd Unfollow Follow

    Latest posts made by rymnd

    • Possible to pass variable to custom m-codes?

      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

      posted in Gcode meta commands
      rymndundefined
      rymnd
    • RE: Cannot call Macro containing custom m-code before custom m-code

      @chrishamm Thanks so much for the fast reply! Regarding your #2 on separate scripts, you're referring to the dsf python code on the RPi side that intercepts the custom m-codes, correct?

      I've also found that if both custom m-codes are wrapped in their own macro files and called via M98 on the same level, that works too

      posted in Gcode meta commands
      rymndundefined
      rymnd
    • Cannot call Macro containing custom m-code before custom m-code

      Apologies in advance if I've been missing something obvious, but I've been having problems getting custom m-codes working the way I'd like on the Duet 3, RRF ver 3.4.5

      I've found that if I call a macro containing a custom m-code with M98 right before calling another custom m-code, the RPi-side code will freeze, and I can only continue after hitting the GUI's emergency stop button to restart the Duet. I'm able to get around this issue by removing the flush command, but then the custom m-code after the macro completes before the custom m-code within the macro. My test code is based almost entirely on the custom m-code example from the dsf-python repository:

      dsf_server.py:

      from dsf.connections import InterceptConnection,InterceptionMode,CommandConnection
      from dsf.commands.code import CodeType
      from dsf.object_model import MessageType
      import time
      
      if __name__=="__main__":
          filters = ["M1234","M1111"]
      
          intercept_connection = InterceptConnection(InterceptionMode.POST,filters=filters,debug=True)
          intercept_connection.connect()
          print("Connected and listening...")
      
          try:
              while True:
                  cde = intercept_connection.receive_code()
                  cde_str = str(cde.type)+str(cde.majorNumber)
      
                  if cde_str in filters:
                      intercept_connection.flush(cde.channel)
                      print(cde_str)
      
                  if cde.type==CodeType.MCode and cde.majorNumber==1234:
                      #report time of execution
                      time_executed = round(time.time(),2)
                      msg_type = MessageType.Success
                      msg = "Time completed: {}".format(time_executed)
      
                      intercept_connection.resolve_code(msg_type,msg)
                  elif cde.type==CodeType.MCode and cde.majorNumber==1111:
                      #blank, filler m-code to fill the m queue
                      intercept_connection.resolve_code()
      
          except Exception as e:
              print("Error")
              intercept_connection.close()
      

      Test gcode that fails:

      M98 P"/tests/Wrapper"
      M1234
      

      Wrapper macro file:

      M1111
      

      Can we just not put custom m-code calls inside of macros that are used in other macros or gcode files? Or has anyone else run into any similar issues? Thanks so much for your time!

      posted in Gcode meta commands
      rymndundefined
      rymnd