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?
Posts made by pouryatorabi
-
Sending data from python server to Duet
-
RE: perform_simple_code is not working on DSF 3.5.2
@chrishamm I moved everything in a macro and now it works, thanks.
-
perform_simple_code is not working on DSF 3.5.2
Hi,
We were using this function to send some parameters from python to Duet:def updateGlobalVar(self,varname, val): cc = CommandConnection() cc.connect() ############ This is Ray's code to store data to the Duet side, There might be a better way to do that cc.perform_simple_code("if exists(global.{})".format(varname)) cc.perform_simple_code(" set global.{}={}".format(varname,val)) cc.perform_simple_code("else") cc.perform_simple_code(" global {}={}".format(varname,val)) cc.close()
It doesn't work anymore after I have upgraded to DSF 3.5.2.
The previous version was:
Board: Duet 3 MB6HC (MB6HC)
DSF Version: 3.4.6
Firmware: RepRapFirmware for Duet 3 MB6HC 3.4.6 (2023-07-21) -
RE: Sending Parameters to Python
@chrishamm
Board: Duet 3 MB6HC (MB6HC)
DSF Version: 3.4.6
Firmware: RepRapFirmware for Duet 3 MB6HC 3.4.6 (2023-07-21) -
RE: Sending Parameters to Python
@chrishamm Can you tell me how to find the DSF Version? Also the code I have sent is actually my full macro:
var LayerNo= 0 if exists(param.L) set var.LayerNo = param.L M1560 P{var.LayerNo}
I just send the M1560 command with my current layer number to python side, that is the full macro.
-
RE: Sending Parameters to Python
@chrishamm
So I have a macro and inside that I have:var Test = 0 if exists(param.L) set var.Test = param.L M1560 P{var.Test}
so I call that macro with: M98 P"/macros/ReadSensor" L6
But on the python side I receive:M1560 P{var.Test}
not
M1560 P6.
-
RE: Sending Parameters to Python
Hi,
I have a bunch of custom M commands that I send to python from my duet. I have created a separate macro for each one so I call that macro instead of sending the M command it self. For example in my g code, if I want to send M1570, I have a separate macro that is called Read sensor and in that macro I have written M1570, so I just call:
M98 P"/macros/ReadSensor"
So, in my gcode, if I want to use another M command, I have to make another macro for that M command, otherwise I get into a lot of trouble, because duet runs the macros and M commands at the same time.
My problem is that, if I want to send a variable to python side, I have to first send that variable to a macro and within that macro receive that var and send it to python, but M command doesn't support for example M1570 L{var.Parameter}, how can I then send that var? -
Sending Parameters to Python
Hi,
It seems the M commands doesn't support adding a param like "M1563 {var.Param}", So how can I send a var to the python side?