Manual filament-change.g syntax
-
@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". -
@Surgikill said in Manual filament-change.g syntax:
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'.
I've run some tests myself.
When M600 is used in a print, it looks like the pause start doesn't occur until after filament-change exits (or pause.g exits if filament-change.g didn't exist).
Therefore M24 within filament-change.g won't work as it's not yet in the paused state.
So I'm not sure how you can create a resume prompt.
You can't do it in the print file, because it won't be active until the print is resumed.
About all I can think of would be set a global in filament-change.g and do a check in daemon.g
something likeif global.doingChange = true && state.status="paused" M291 S4 K{"Yes","No",} R"Resume print?" if result = 0 M24 set global.doingChange = false
-
@Surgikill said in Manual filament-change.g syntax:
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.
Further to my post above, you could do the unloading and loading in filament-change.g
In my case I have a universal_load and universal_unload macro.
Each of my filaments load.g and unload.g this as does filament-change.gSo your filament.g could work per your original thinking as far a using M98 to call pause.g to do the movements
Then call your unload and reload macros
It will still not be in the paused state till after all this, so you've either got to it the resume button or do something like I posted above.
I don't see having to hit resume as being a big deal. -
A little further digging confirms that until filament-change.g has completed the printer status is pausing.
I put this in filament.change.g
echo "Printer state is: ", state.status
And got back
Printer state is: pausing
And looking at the 3.5b3 source for M24 it specifically ignores any M24 call in that statecase 24: // Print/resume-printing the selected file if (pauseState == PauseState::pausing || pauseState == PauseState::resuming) { // ignore the resume request }
-
I'm working out a solution to do what you're asking for now @Surgikill, based on what @OwenD mentioned above with a global and
daemon.g
.I've got a proof of concept
filament-change.g
&daemon.g
writen, but i haven't got time to test it before tomorrow. -
@OwenD My issue with resuming the print with the resume button is it is very easy to fat finger the cancel button. There also is no sanity check after hitting the cancel button, hence why I want the resume to happen in its own prompt, therefore no fat fingering can happen. Even having a system prompt occur to resume print after filament-change.g completes would be preferable to having to use the resume print function.
@Phaedrux I'm using it on dwc, but I also have a machine with a paneldue that I can try it on, but it appears that doesn't matter from what @OwenD has figured out.
@Exerqtor Could this just be a bug and M600 with filament-change.g is not working as intended? From the wording of the documentation, it seems like the order of operations is 'pause printer'>'execute filament-change.g (or pause.g)'. It seems as though the filament-change.g is locked inside the pause operation, although the source for 3.5b3 seems to indicate that it is intended to lock the printer in a pausing state during a filament change.
-
@Surgikill calling pause.g at the start of filament-change.g is OK if it does what you need at that point.
Perhaps we need to allow a M24 within filament-change.g to resume the print as soon as filament-change.g has completed.
-
@dc42
That would surely make life a bit easier
@Surgikill
This is how I've "solved" it:
filament-change.g:
; /sys/filament-change.g v2.1 ; Called when M600 is sent ; Used to do a filament change while printing ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Will not be used if you're using a "goto" macro var x = 40 ; The X axis location where you want the hotend to "park" while changing filament var y = 0 ; The Y axis location where you want the hotend to "park" while changing filament var lift = 40 ; The Z clearance you want your nozzle to have from the print while changing filament var lights = true ; true / false depending if you have chamber lights or not that you want to turn on ; If you don't have lights you want to turn on don't mess with these var io = 0 ; The GPIO port number (set by M950) for the lights you want to turn on var pwm = 1 ; The PWM to be set on the GPIO port above, 0=off 1=full power var purge = 60 ; The amount of filament your hotend need to purge for a clean filament/color change ; Will be swaped out with global.unload_length if you have that defined! var unload = 12 ; The length of which filament have to be retracted to clear the meltzone ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.unload_length) set var.unload = global.unload_length if var.lights M42 P{var.io} S{var.pwm} ; Turn on the lights if fileexists("/sys/lib/beep/l.g") M98 P"/sys/lib/beep/l.g" ; Long beep M400 ; Wait for moves to finish G91 ; Relative positioning M83 ; Extruder relative positioning G10 ; Retraction G1 Z1.00 X20.0 Y20.0 F20000 ; Short quick move to disengage from print G1 Z{var.lift - 1} F800 ; Go to spesified Z clearance if !fileexists("/sys/lib/goto/front_right.g") G90 ; Absolute positioning G1 X{var.x} Y{var.y} F6000 ; Move the nozzle to the location defined in the settings section if fileexists("/sys/lib/goto/front_right.g") M98 P"/sys/lib/goto/front_right.g" ; Move to front right for filament change G1 E2 F800 ; Extrude slightly to help form a nice tip on the filament G1 E{-(var.unload)} F800 ; Retract filament from the meltzone M400 ; Wait for moves to finish if fileexists("/sys/lib/beep/xl.g") M98 P"/sys/lib/beep/xl.g" ; Extra long beep M291 R"Manual Filament Change" P"Change & prime filament, then press OK." K{"OK","SKIP",} S4 ; "OK" if input = 0 G1 E{var.purge} F200 ; Purge filament ; "SKIP" if input = 1 G1 E{var.unload} F800 ; Extrude filament back to the meltzone if !exists(global.FilamentCHG) global FilamentCHG = true else set global.FilamentCHG = true
daemon.g:
; /sys/daemon.g ; Used to execute regular tasks, the firmware executes it and once the end of file is reached it waits. If the file is not found it waits and then looks for it again. ; Loop, to be able to turn on/off daemon.g while global.RunDaemon ; Stuff goes here ; Resume after filament change if exists(global.FilamentCHG) if global.FilamentCHG = true && state.status="paused" M24 ; Resume the pause automatically now that the manual filament change is done set global.FilamentCHG = false
resume.g
; resume.g ; Called before a print from SD card is resumed G1 R1 X0 Y0 Z5 F6000 ; Go to 5mm above position of the last print move G1 R1 X0 Y0 ; Go back to the last print move M83 ; Relative extruder moves
-
@dc42 Putting the printer in a pause state before filament-change.g is run would also work, although that seems like it may be more work. Either one would be great though.
-
@Exerqtor
Your M24 is not indented in the example -
@OwenD said in Manual filament-change.g syntax:
@Exerqtor
Your M24 is not indented in the exampleIt should be
🤣
Typo when I pasted it into the forum😳
I'm using it right now btw, and the pause-resume handeling is working just like intended
✌️
(the rest if the macro needs a little polishing though) -
@Exerqtor Thanks for that. I'm going to try modify those files a bit to set them up the way I want. From the documentation it looks like daemon.g will work on 3.4.5.
-
No problem! Yeah sorry I just copied that part from my
daemon.g
which containsif fileexists
farther down (I'll edit the post straight away).If you're running pre 3.5 the only thing you would HAVE to change in
filament-change.g
is to remove the following lines:- 41-42
- 52
- 54-55
- 63-64
EDIT:
I forgot to mention you would of course also swap out the
M291
(line 66-72) with something pre RRF3.5 friendly, like this for instance:M291 S2 R"Manual Filament Change" P"Change & prime filament, then press OK." G1 E{var.purge} F200 ; Purge filament
-
For who it might concern/help, I feel like I've got
filament-change.g
working decently well at this point:; /sys/filament-change.g v2.2 ; Called when M600 is sent ; Used to do a filament change while printing ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Will not be used if you're using a "goto" macro var x = 40 ; The X axis location where you want the hotend to "park" while changing filament var y = 0 ; The Y axis location where you want the hotend to "park" while changing filament var spd = 15000 ; The speed of which you want the hotend to move to the "park" location var lift = 20 ; The Z clearance you want your nozzle to have from the print while changing filament var lights = true ; true / false depending if you have chamber lights or not that you want to turn on ; If you don't have lights you want to turn on don't mess with these var io = 0 ; The GPIO port number (set by M950) for the lights you want to turn on var pwm = 1 ; The PWM to be set on the GPIO port above, 0=off 1=full power var purge = 60 ; The amount of filament your hotend need to purge for a clean filament/color change ; Will be swaped out with global.unload_length if you have that defined! var unload = 12 ; The length of which filament have to be retracted to clear the meltzone ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.unload_length) set var.unload = global.unload_length var pwm_res = state.gpOut[{var.io}].pwm ; Store the PWM from the PPIO port so that it can be returned after changing filament if var.lights M42 P{var.io} S{var.pwm} ; Turn on the lights if fileexists("/sys/lib/beep/l.g") M98 P"/sys/lib/beep/l.g" ; Long beep M400 ; Wait for moves to finish G91 ; Relative positioning M83 ; Extruder relative positioning G10 ; Retraction G1 Z1.00 X20.0 Y20.0 F20000 ; Short quick move to disengage from print G1 Z{var.lift - 1} F800 ; Go to spesified Z clearance if !fileexists("/sys/lib/goto/front_right.g") G90 ; Absolute positioning G1 X{var.x} Y{var.y} F{var.spd} ; Move the nozzle to the location defined in the settings section if fileexists("/sys/lib/goto/front_right.g") M98 P"/sys/lib/goto/front_right.g" {var.spd} ; Move to front right for filament change G1 E2 F800 ; Extrude slightly to help form a nice tip on the filament G1 E{-(var.unload)} F800 ; Retract filament from the meltzone M400 ; Wait for moves to finish if fileexists("/sys/lib/beep/xl.g") M98 P"/sys/lib/beep/xl.g" ; Extra long beep M291 S4 R"Manual Filament Change" P"Change & prime filament, then press OK." K{"OK","SKIP",} ; "OK" if input = 0 G1 E{var.purge} F200 ; Purge filament ; "SKIP" if input = 1 G1 E{var.unload} F800 ; Extrude filament back to the meltzone M400 ; Wait for moves to finish if var.lights M42 P{var.io} S{var.pwm_res} ; Return lights to previous state if !exists(global.FilamentCHG) global FilamentCHG = true else set global.FilamentCHG = true
-