Manual filament-change.g syntax
-
Hi all,
I'm trying to set up a more streamlined solution to manual filament changes. Currently, I have M600 in my print file, the printer pauses, I swap the filament, and then I resume the print.
What I want to happen is the print to pause, the filament to automatically retract, swap filament, press a button to load filament, and then resume the print after a prompt.
I'm hung up on how I should pause the print. M600 calls filament-change.g, instead of pause.g. I would like to have something enable pause.g in my filament-change.g file. M25 seems like it would be the solution, but the documentation says that if a pause is commanded while a macro is being run, the pause will be deferred. Can I not call out to pause.g inside of filament-change.g, or do I have to use M98 to run pause.g?
Thanks.
Edited to replace M226 with M600 due to typo.
-
@Surgikill M226 should not call filament-change.g, it should call pause.g instead. Maybe you're confusing that with M600?
Of course you can call pause.g from your filament-change.g using
M98 P"pause.g"
. -
@chrishamm Yes, sorry, I meant M600. M226 documentation still says that it should not be used in a macro file, so I should use M25 instead. Will this accomplish what I am looking for, or should I just use M98?
-
I think you're overthinking it. Just use M600 and put what you want to happen in filament-change.g. I believe the pause is implied with M600, so it will stop printing and execute the commands in filament-change.g and then you get a prompt to resume.
-
@Phaedrux The thing is, when I pause the print, I have the print head move to a dock position that is done in pause.g. I think if I just run M600, it will run filament-change.g, but I would have to manullly write in the specific docking parameters. I would rather have that in pause.g, so whenever I edit pause.g, it gets updated where it is used.
-
Extrapolate that one further then. Create a macro called docking.g and put your docking position there. Then call that macro from pause.g and filament-change.g
Or if you want to get really fancy you could use global variables and conditional gcode.
-
@Phaedrux conditional gcode is the end goal to prevent unwanted behavior, but I'm still learning the ins and outs.
-
@Phaedrux Alright, apparently I'm just not understanding how the pause function works.
If I run this macro, the print head moves back to the last position and just sits there until I press 'resume' on the machine.
;Pause print and move printhead M98 P"0:/sys/pause.g" ; pause the print ;Retract filament, then prompt user to load filament T0 ;Select tool G1 E-55 F3000 ;Retract 100mm filament at high speed M84 E0 ;turn extruder motor off to let user unload if filament locked - M291 P"Insert filament, then press OK to load filament" R"Filament Change" S3 T0 ; Select tool G1 E55 F200 ; extrude 55mm at low speed M84 E0 ; turn extruder motor off so the user can feed by hand - change for another tool ;Prompt user to resume print if filament change is successful M291 P"Resume Print?" R"Resume Print?" S3 M98 P"0:/sys/resume.g" ; resume the print
If instead, I use this macro, the printer does nothing, even though M24 is in there, and will only resume once I press 'resume' on the machine.
;Pause print and move printhead M98 P"0:/sys/pause.g" ; pause the print ;Retract filament, then prompt user to load filament T0 ;Select tool G1 E-55 F3000 ;Retract 100mm filament at high speed M84 E0 ;turn extruder motor off to let user unload if filament locked - M291 P"Insert filament, then press OK to load filament" R"Filament Change" S3 T0 ; Select tool G1 E55 F200 ; extrude 55mm at low speed M84 E0 ; turn extruder motor off so the user can feed by hand - change for another tool ;Prompt user to resume print if filament change is successful M291 P"Resume Print?" R"Resume Print?" S3 M24
Is there any way I can get the resume function from the 'resume' button in a gcode command? Or do I have to run M25 in the file somewhere to get M24 to work?
-
Don't call resume from within pause. That's your problem.
Or better yet, use M600 and filament-change.g?
-
@Phaedrux This IS my filament-change.g which is called by M600. I mistakenly said M226 in my first post. I don't receive a resume prompt when using filament-change.g, which is what I am trying to incorporate in my filament-change.g file.
What I meant by not understanding how the pause function works, is what needs to happen for M24 to work. I call the pause.g in the beginning of my filament-change.g macro. This is my pause.g
; pause.g ; called when a print from SD card is paused ; ; generated by RepRapFirmware Configuration Tool v3.3.15 on Mon Dec 26 2022 22:40:57 GMT-0500 (Eastern Standard Time) M83 ; relative extruder moves G1 E-10 F3600 ; retract 10mm of filament G91 ; relative positioning G1 Z15 F360 ; lift Z by 15mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0
So all it is doing is moving the head to the home position. Then, the filament change happens in filament-change.g with the accompanying prompts. Then there is a final prompt, which I have tried with M24 and by calling resume.g with M98. Neither of these options actually resume the print. The printer will either move back to the last printing position and sit there, not resuming, OR, it will sit at the home position with M24, and only move back to the final position and resume printing once I press 'resume print' on the status page, so there is SOMETHING happening after my resume.g is run, otherwise the printer would resume printing after running resume.g.
-
@Surgikill said in Manual filament-change.g syntax:
I call the pause.g in the beginning of my filament-change.g macro.
I don't think you should do that. M600 should already be pausing and resuming on it's own.
-
@Surgikill said in Manual filament-change.g syntax:
This IS my filament-change.g which is called by M600. I mistakenly said M226 in my first post. I don't receive a resume prompt when using filament-change.g, which is what I am trying to incorporate in my filament-change.g file.
What I meant by not understanding how the pause function works, is what needs to happen for M24 to work. I call the pause.g in the beginning of my filament-change.g macro.As @Phaedrux said, you should not be calling pause.g
M600 already does a pauseM600: Filament change pause
Supported in firmware 2.02 and later.
This command behaves like M226 except that if macro file filament-change.g exists in /sys on the SD card, it is run in preference to pause.g.As you have a filament-change.g, it will run that file.
If you want to have a prompt to resume, then add it to the end of your filament-change.g or your filament load.g
An M291 call would sufficeM291 P"OK to resume?" S3 M24
-
@Phaedrux Okay, so what exactly does
M98 P"0:/sys/pause.g"
do?
From my understanding, all it does is run the file 'pause.g', which has no 'pause' in it, the pause has already occurred from the M600, and the 'pause.g' is just moving the extruder away from the print, not actually causing the pause to happen. If I renamed the file to 'move-extruder.g', it should do the same thing, no? Or is there something happening behind the scenes when I am invoking pause.g with M98, that is causing a double pause to happen?
Seeing as M600 is the same as M226, the M226 documentation says:
Initiates a pause in the same way as if the pause button is pressed, except that execution of all prior GCode commands in the same input stream is completed first. Then the SD card input stream is paused and file sys/pause.g is run.
which to me means that pause.g has no effect on pausing the print, seeing as the documentation says that the printer is paused BEFORE 'pause.g' is run.
To test it, this is now my filament-change.g
;Pause print and move printhead M98 P"0:/sys/move-extruder.g" ; pause the print ;Retract filament, then prompt user to load filament T0 ;Select tool G1 E-55 F3000 ;Retract 100mm filament at high speed M84 E0 ;turn extruder motor off to let user unload if filament locked - M291 P"Insert filament, then press OK to load filament" R"Filament Change" S3 T0 ; Select tool G1 E55 F200 ; extrude 55mm at low speed M84 E0 ; turn extruder motor off so the user can feed by hand - change for another tool ;Prompt user to resume print if filament change is successful M291 P"Resume Print?" R"Resume Print?" S3 M24
and this is move-extruder.g
M83 ; relative extruder moves G1 E-10 F3600 ; retract 10mm of filament G91 ; relative positioning G1 Z15 F360 ; lift Z by 15mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0
now I'm not calling out to 'pause.g', I am calling out to 'move-extruder.g'. The only pause command is M600, which is contained within the gcode file.
This still produces the same errors as before, wherein the print does not resume. Yes @OwenD I am using M291 and M24, but it is in the filament-change.g macro.
@dc42 Any ideas? I'm not sure where the issue is. I can run M24 from a macro, but it seems as though I can't run it from 'filament-change.g'.
-
What firmware version are you using?
Have you tried without M24 at the end?
-
@Phaedrux Version 3.4.5. I have not tried without M24. If it is any indication, the 'pause print' button is greyed out while 'filament-change.g' is being executed, so maybe there is a flag somewhere that is preventing M24 from running.
EDIT: I have tried by using M98 P"0:/sys/resume.g", which has the same effect as M24, but is not the M24 command.
-
I don't think M24 is needed because once the filament-change.g macro has completed it will resume.
-
@Phaedrux Then should it not resume regardless of if M24 is run or not? I have a print running and I'll try it without the M24 and see what happens.
-
@Phaedrux Removing M24 and just leaving the M291 at the end of the script does not work either.
-
Remove the last M291.
Are you using DWC or a PanelDue?
-
@Phaedrux said in Manual filament-change.g syntax:
I don't think M24 is needed because once the filament-change.g macro has completed it will resume.
That's not how my machine does it atleast (on 3.4 or 3.5). If i add a
M291 S2
dialouge infilament-change.g
it goes on to a paused state after pressing "OK" andfilament-change.g
ends. And when i then hit "Resume" from the paused state it runs throughresume.g
. This behaviour is the same on both DWC and PD.One should think that when adding
M24
at the very end offilament-change.g
(after aM291 S2
) on the other hand, it should automagicaly runresume.g
when the macro finishes up, so you don't have to go through the "extra step" of manually pushing "Resume".