Filament unload.g waiting for temperature to drop
-
Hi all,
I'm finally getting around to setting up filaments on my machines. I'm currently running into an issue where if I am changing a filament or unloading a filament, I need to wait for the extruder to cool to the set unload temperature if it is above that temperature. Is there a command I can use that will only extrude if above a certain temp, and if not set that temp. Is there a command I can use to do this, or do I need to use an if statement in my unload.g?
Relevant unload.g
M291 P"Please wait while the nozzle is being heated up" R"Unloading PETG" T5 ; display message G10 S180 ; heat up the current tool to 100C M116 ; wait for the temperatures to be reached M291 P"Retracting filament..." R"Unloading PETG" T5 ; display another message G1 E-5 F100 ; retract 5mm of filament at 300mm/min G1 E-60 F3000 ; retract 60mm of filament at 3000mm/min M400 ; wait for the moves to finish M568 A0 ; turn tool off
Thank you
-
Looking through the documentation, it seems like there is no wait command that checks to see if the temperature is above the setpoint, only a command that can be used to wait with a variable tolerance. This might be able to be used to unload the filament, but seems kind of clunky.
Looking through object models, it seems as if there isn't any object model that tracks the current tool temperature, it only tracks heater temperatures, so the unload cannot be tool agnostic.
My other option would be to use a global variable that is set when the tool temperature is set, but I can't control that in every place the tool temperature can be set, so that can cause an issue.
I can set the load and unload temperatures to be the same temperature, but when swapping between filament the issue arises again if I am going from a high temperature filament to a low temperature filament, it will still need to wait for the temperature to drop before it loads.
I've scoured the forum and I haven't seen anything about this before, not really sure why it hasn't come up. I'm guessing I'm just missing something?
-
@Surgikill
This is my universal unload.g
It covers most of what you want I think but of course will need changes;; Universal unload.g - direct all other filament unoad.g instances to this file ;; ;M929 P"0:/macros/filament/unloadeventlog.txt" S3 echo "entering 0:/macros/filament/universal_unload.g" ;M106 S0 ; fan off ;move to a good height and centre of bed while iterations < #move.axes if !move.axes[iterations].homed M291 S4 K{"Yes","No",} F0 R"Axes unhomed" P"Home all axes?" if input = 0 G28 M400 ; if we're not in a print then move to a safe place to extrude if move.axes[0].homed && move.axes[1].homed && move.axes[2].homed && job.file.fileName = null if (move.axes[0].userPosition!=global.Bed_Center_X) || (move.axes[1].userPosition!=global.Bed_Center_Y) || (move.axes[2].userPosition!=75) M291 R"Positioning" P"Move to safe extrude height?" S4 K{"Yes","No",} F0 if input =0 G1 X{global.Bed_Center_X} Y{global.Bed_Center_Y} Z75 F3600 M400 if state.currentTool==-1 M291 R"No Tool" P"No tool selected. OK to unload tool 0, Cancel to abort" S2 T0 P0 echo "waiting for unload temp" if (move.extruders[state.currentTool].filament == "") || (global.LoadedFilament="") || (global.LoadedFilament==null) M291 R"Error" P"No filament loaded. Unload aborted" S2 T2 M99 var TargetTemp = heat.coldRetractTemperature + 5 ;M291 R{"Unloading " ^ move.extruders[state.currentTool].filament} P"Waiting for nozzle unloading temperature..." S0 T3 M568 P{state.currentTool} S{heat.coldExtrudeTemperature+10} R{var.TargetTemp} A1 ; Heat current tool just enough to cold pull G4 S3 var thisHeater = tools[state.currentTool].heaters[0] ;show progress of heating from lower temp while (heat.heaters[tools[state.currentTool].heaters[0]].current) < (var.TargetTemp - 1) M291 R"Preheating.. Please wait" P{"Current temp = " ^ heat.heaters[var.thisHeater].current ^ " : target = " ^ var.TargetTemp} S0 T2 G4 S1.8 if global.Cancelled = true M108 M98 P"0:/macros/heating/all_heaters_off.g" abort "heating cancelled" if (heat.heaters[var.thisHeater].current) > (var.TargetTemp + 1) echo "Fan on to help cooling faster" M106 S1 ;show progress of cooling from hotter temp while (heat.heaters[var.thisHeater].current) > (var.TargetTemp + 1) M291 R"Preheating.. Please wait" P{"Current temp = " ^ heat.heaters[var.thisHeater].current ^ " : target = " ^ var.TargetTemp} S0 T2 G4 S1.8 if global.Cancelled = true M108 M98 P"0:/macros/heating/all_heaters_off.g" abort "heating cancelled" M106 S0 ; turn off part fan M116 ; Wait for temperature to be within 0.5 degrees of target echo "waiting for filament to settle" ;M291 R{"Unloading " ^ move.extruders[state.currentTool].filament} P"Waiting for filament to soften (or firm)..." S0 T10 G4 T10; Wait for additional delay for filament to cool or soften echo "unloading" M291 R{"Unloading " ^ move.extruders[state.currentTool].filament} P"Retracting..." S0 T5 M98 P"0:/macros/filament/do_moves_for_unload.g" M568 P{state.currentTool} S{heat.coldExtrudeTemperature+10} R{var.TargetTemp} A2 ; Heat current tool to cold extrude temp echo "Heating to cold extrude temp.. Please wait" M116 echo "unloading complete - exiting universal_unload.g" ;M929 S0
-
@OwenD Thank you.
Would you mind explaining your reasoning behind some of the actions taken in that macro?
For instance, I see that you have an if statement there to turn the fan on to cool the hotend, and a while loop to wait for the hotend to cool. What's the reasoning behind waiting for the hotend to cool, besides waiting for the filament to solidify?
Also, is there any reason you are checking to see if the machine is homed before unloading filament? I'm not sure what type of machine you have, so I don't know if that's a requirement for your machine or if there is other reasoning behind it.
Lastly, it seems that there is only one cold extrusion temperature that can be set with M302, correct? I currently do not have a M302 in my config.g, or anywhere that I can find, but my M409 query of heat.coldExtrudeTemperature shows it at 160C, and heat.coldRetractTemperature is 90C. Are these default values, or am I missing something?
Thank you for all your help.
-
@Surgikill said in Filament unload.g waiting for temperature to drop:
@OwenD Thank you.
Would you mind explaining your reasoning behind some of the actions taken in that macro?
For instance, I see that you have an if statement there to turn the fan on to cool the hotend, and a while loop to wait for the hotend to cool. What's the reasoning behind waiting for the hotend to cool, besides waiting for the filament to solidify?
Exactly that
I want the filament to be cold enough to do a cold pull.
This should remove all filament from the nozzle.
The fan may or may not make a difference.Also, is there any reason you are checking to see if the machine is homed before unloading filament? I'm not sure what type of machine you have, so I don't know if that's a requirement for your machine or if there is other reasoning behind it.
Only that I like to move the nozzle a good way off the bed when I'm changing filament
Lastly, it seems that there is only one cold extrusion temperature that can be set with M302, correct? I currently do not have a M302 in my config.g, or anywhere that I can find, but my M409 query of heat.coldExtrudeTemperature shows it at 160C, and heat.coldRetractTemperature is 90C. Are these default values, or am I missing something?
160 may be the default
I set the temps for cold extrude and cold retract in my filaments/xxx/config.g
I also set things like retract distance etc for each filament there.Thank you for all your help.
No problem
-
@OwenD One more question. On line 26 I see that you have global.LoadedFilament. I'm assuming you are assigning this variable somewhere in your load.g for the filament that you load, correct? Is there a reason that you are using this instead of just relying on the move.extruders[state.currentTool].filament object model? Also, why are the items in parentheses? Is it because of the syntax or something else?
-
@Surgikill
I use that global in several places.
It is initially set in config.g but I use it to check if the filament in the slicer matches the loaded one in DWC and also to load the settings for the new filament during a change because you can't call M703 from within load.g (from memory) so I call M98 to set the new cold extrude and extract settings before heating for the new filamentThe best I can offer is to say have a dig around in my setup which is on GitHub
https://github.com/owendare/RepRapFirmware-Macros
I'm pretty sure it's up to date.
They're nothing special about my printer. Just an I3 clone with a single water cooled extruder at present.
Gave up on multi extruders 🤪 -
@OwenD Well, you also just answered one of my questions from this post I just made https://forum.duet3d.com/post/314256.
Thank you for the github link. Looks like I know what I am doing tomorrow.
Why did you give up on multi-extruders? I'm currently in the process of trying to turn this printer into a toolchanger. I'm still conflicted on it.
-
@Surgikill
A tool changer would be different
I was using chimera and the like.
Was always more trouble than it was worth -
@Surgikill said in Filament unload.g waiting for temperature to drop:
@OwenD Well, you also just answered one of my questions from this post I just made https://forum.duet3d.com/post/314256.
I'm not 100% sure on the M703 thing
There was some issue along those lines, but it's been a while and those particular brain cells may have been "adjusted" since then -
@Surgikill said in Filament unload.g waiting for temperature to drop
Why did you give up on multi-extruders? I'm currently in the process of trying to turn this printer into a toolchanger. I'm still conflicted on it.
I too am in the process of giving up on multiple extruders as I've finally (after many years of use) come to the conclusion that the time, effort and complexity outway the benefits. In my case, after a brief forray into multiple nozzles, I used combining hot ends (I don't like to use the word "mixing" because none of actually mix), initially the diamond 3 input, then the diamond 5 input and finally my own design 6 input. The latest iteration of that design had two heat zones enabling me to use multiple filament types without over heating any of the other loaded filaments. But I soon discovered that there are very few filament combinations that will actually work together. For example, TPU and Polypropylene would only stick to themselves and not to any other filament type that I tried. So I was back to only using the same filament types i.e multi coloured objects. But 95% or more of the things I want to print are single colour. Yet because I had 6 extruders, and because I didn't want 1 metre long Bowden tubes, I had them mounted on a separate gantry (the UV axes) which means that I have to post process every gcode file to generate the necessary UV moves.
I did briefly consider turning the machine into a tool changer, but given that there are very few combinations of filament that work together, I decided that it was a lot of time, effort and expense to have the ability to print say support material in addition to the main part. YMMV of course but I'd strongly urge you to do a cost/benefit analysis (include time as well as money) on whether a tool changer would be worth doing). -
@Surgikill said in Filament unload.g waiting for temperature to drop:
On line 26 I see that you have global.LoadedFilament. I'm assuming you are assigning this variable somewhere in your load.g for the filament that you load, correct?
FYI this is my slicer start gcode
Without it some of the other macros may not make sense.M98 P"0:/sys/checkATX.g" ; M98 P"0:/macros/print/start_after_delay.g" H6 S30 R"2022-01-04T17:15:00" ; uncomment to use delayed start M118 S"Begin slicer start g code" ;M104 S0 R0 P{current_extruder} ; Set temps to zero to stop slicer adding them set global.Cancelled = false T{current_extruder} ; select tool M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A1 ; (set extruder to standby to soften any protruding filament before probing ) M106 P{current_extruder} S0 ;Start with fan off M118 S"Heating Bed" G4 S1 M140 S{first_layer_bed_temperature[current_extruder]} R{bed_temperature[0]-20}; Set fast bed temp & standby - Standby is 20 degrees less than normal. M116 ; Wait for bed before doing mesh probe. M561 ; clear any bed transform M291 S0 T3 P"Homing..." G32 ; Level bed & home G28 ; Home all until duel Z driver fixed M400 ; wait for last move set global.LoadedFilament="{filament_type[current_extruder]}" ; set the global filament name variable M98 P"0:/macros/filament/check-filament-type.g" ; All retraction and temp settings done in 0:/filaments/[filament_type]/config.g M703 ; load config file for [filament_type] M593 P"zvddd" F59.03 ; use ZVDDD input shaping to cancel ringing at 59.03Hz M83 ; Set relative extrusion M98 P"0:/macros/songs/charge.g" ; play start tune G4 S4 ; Wait 4 Seconds for song G21 ;metric values G90 ; Switch to using Absolute Coordinates M98 P"0:/sys/checklimits.g" A{first_layer_print_min[0]} B{first_layer_print_max[0]} C{first_layer_print_min[1]} D{first_layer_print_max[1]} E{(total_layer_count-1)*layer_height+first_layer_height} ; check that the print is within the bed limits M98 P"0:/sys/mesh.g" A{first_layer_print_min[0]} B{first_layer_print_max[0]} C{first_layer_print_min[1]} D{first_layer_print_max[1]} N40 ; set N to your desired distance between probe points G29 S1 ; load small mesh M98 P"0:/sys/checkMesh.g" ; check if the mesh is within specs G01 X0 Y{"{move.axes[1].max}"} Z0.6 F1500 ; Move to back corner while heating M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A2 ; (set standby and active temperatures for active tool. Standby is 5 degrees above cold extrude temp ) M118 P3 S" Waiting for temps..." G4 S1 ; Wait 1 Second M116 ; Wait for all temps to stabilize G1 X0 Y{"{move.axes[1].max -5}"} Z0.3 F1200 ; move to edge to wipe any oozed filament M98 P"0:/macros/print/doPrimeLine" S{extrusion_multiplier[current_extruder]} D{nozzle_diameter[current_extruder]} F{filament_diameter[current_extruder]} ; does prime line with calculated extrusion amount G10 ; Retract G1 Z0.1 ; lower head G1 X50 F1200 ; wipe G1 Z10 ; raise head G92 E0 ; reset extruder M118 P3 S" Printing..." ;Put printing message on screen