M291 Not Blocking
-
I want to setup a macro that pauses my print, waits for me to change the filament, and continues with the print after I confirm that the changeover is complete. From what I've been able to find, M291 would be the way to do that. However, when my macro is called, the printer moves to a clearance plane, displays the message, and continues to print at the elevated plane. When I confirm the message, it goes back down to the original printing height, and continues to print. Am I using M291 incorrectly? See macro code below:
M83 ; relative extruder moves G1 E-1.5 F3600 ; retract G91 ; relative positioning G1 Z50 F360 ; lift Z by 50mm G60 S5 ; save current position to slot 5 M98 P"/macros/print_scripts/goto_front_middle.g" ; move to front for filament change M400 ; Wait for all moves to complete M226 ; PAUSE AND WAIT M291 P"Change and purge filament. Resume when changeover complete" R"Mid-print Filament Change" S2; G0 R5 ; move back to saved position G91 ; relative positioning G0 Z-50 ; drop back down to printing height M83 ; relative extruder moves G1 E1.5 F3600 ; unretract G90 ; absolute positioning
-
How are you executing that code?
From the docs:
M226 is intended for use in the GCode file being printed, for example to pause after a particular layer has completed. So it waits until all the moves in the queue have been completed. M25 is intended for use from a different source of GCodes (such as the web interface console, PanelDue or a Macro), so if you need to pause from those use M25 instead.
Frederick
-
@beefymclargehuge
What firmware version?
I vaguely remember some earlier versions had an issue with M291 not blocking if it was called in nested macros.
So if the macro shown is being called from another macro that may apply. -
M600 would be the proper way to do a filament change.
https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m600-filament-change-pause
Your macro would go in filament-change.g. M600 would be inserted into your gcode file where you want the change to occur.
You wouldn't use M226 in your macro, because the M600 would already do the pausing.
-
Thanks for the replies all!
@phaedrux that was it! Thank you very much. This condensed my macro down to this:
G91 ; relative positioning G1 Z50 F360 ; lift Z by 50mm M98 P"/macros/print_scripts/goto_front_middle.g" ; move to front for filament change M291 P"Change and purge filament. Resume when after complete." R"Mid-print Filament Change" S2; G0 Z-50 ; drop back down to printing height G90 ; absolute positioning
-
-