Does anyone use M120 or M121?
-
I am currently implementing variables in RRF conditional GCode. Unfortunately, there is an interaction between conditional GCode and M120/M121 that causes serious complications. Does anyone actually use M120 and M121? I am tempted to remove them.
Note, any time that a macro is called (whether implicitly by RRF or explicitly using M98), a push and pop are done around the macro call automatically.
-
Hi,
I've seen them in the list of commands but have never had any reason to use them.
Frederick
-
Same here. Never used it.
-
@dc42 said in Does anyone use M120 or M121?:
M120
Yes, I use it for certain operations not controlled by duet macros where I need to save system state before executing commands from remote sources.
-
@lee7670 said in Does anyone use M120 or M121?:
@dc42 said in Does anyone use M120 or M121?:
M120
Yes, I use it for certain operations not controlled by duet macros where I need to save system state before executing commands from remote sources.
Can you provide examples?
-
@dc42 please don’t remove push and pop. It is used for python post scripts that enable toolchanger post script by mkudzia84 to work.
-
That script is a nice little post for PrusaSlicer. And not only for Toolchangers but any IDEX or multihead rigs..
-
@MaracMB I was able to use SuperSlicer (PrusaSlicer fork) with an IDEX without the need for any postprocessing ... regarding M120/121 -- I had looked into using them in homing macros to save state before and after sensorless homing, but the set of settings saved and restored simply didn't match. So I never used them.
-
@oliof and it preheated hotend before toolswap?
It is not the ability to use, it’s the additional functionality it gives. You can use any slicer with IDEX, that’s not the point -
@MaracMB said in Does anyone use M120 or M121?:
@dc42 please don’t remove push and pop. It is used for python post scripts that enable toolchanger post script by mkudzia84 to work.
If you mean this usage:
;; TOOL_BLOCK_END:{previous_extruder} T{next_extruder} M120 M98 P"prime.g" M121 ;; TOOL_BLOCK_START:{next_extruder}
then M120/M121 is redundant in that context, because of the implicit push/pop around any macro call.
-
@dc42 ok. Great then
-
It turns out that DWC uses M120/M121 for good reason. So I won't remove them any time soon.
-
@dc42 I was about to say it is used in DWC and I use it in a similar fashion in my gamepad jogger plugin.
-
@MaracMB said in Does anyone use M120 or M121?:
and it preheated hotend before toolswap?
Ah, that's nice!
-
@dc42 said in Does anyone use M120 or M121?:
... a push and pop are done around the macro call automatically.
What will happen to a variable that was changed by a macro, will its old value be restored by the pop?
-
@dc42 Since you're keeping m120/m121, does this delay your implementation of variables significantly?
-
@ctilley79 said in Does anyone use M120 or M121?:
@dc42 Since you're keeping m120/m121, does this delay your implementation of variables significantly?
Only by a few hours, I hope.
-
This post is deleted! -
@dc42 said in Does anyone use M120 or M121?:
It turns out that DWC uses M120/M121 for good reason. So I won't remove them any time soon.
With variable declaration, I believe @chrishamm and anyone else can write their own push/pop routine and store/restore any variable they like?
-
PanelDue also use M120/M121 gcodes
case evExtrude: case evRetract: if (currentExtrudeAmountPress.IsValid() && currentExtrudeRatePress.IsValid()) { SerialIo::Sendf("M120 M83 G1 E%s%s F%s M121\n", (ev == evRetract ? "-" : ""), currentExtrudeAmountPress.GetSParam(), currentExtrudeRatePress.GetSParam()); } break;