Sending data from python server to Duet
-
Hi,
Right now I'm sending some M commands like M1585 with a Macro, and on the server side when I receive M1585 I run a function. That function returns a data that I want to send it back to the macro and do something with it. Can someone tell me the way of doing it? -
Hi,
you could have a parameter in the macro like "param.R" for example.
If you call the macro with the parameter, it will act as if it received a resultM1585 -> Server ....calculate... M1585 R{result} <- Server
of course that's not synchronous. If you want to wait for the answer, another option would be to use a message box. That would be a little bit more complicated, although much more flexible
Afaik there is no other way to wait for a message via GCODE...
-
@adambx
Hi,
Thank you for your reply, that's what I'm doing right now and I thought there might be a better option, but this is how I call a macro with python:cc = CommandConnection() cc.connect() cc.perform_simple_code('M98 P"/macros/SomeMacro" L{}'.format(val))
Is there any other safer or better way to all a macro with python server?
-
@pouryatorabi I can't think of anything, but am looking forward to suggestions, if there are any by others