g-code to restore previous fan speed

Get answers & advice for all of your 3D printing & Free Software needs here!
Post Reply
jlund
Posts: 61
Joined: Tue Jul 12, 2016 12:31 pm

g-code to restore previous fan speed

Post by jlund » Fri Oct 12, 2018 12:41 am

Is there a g-code command working with Lulzbot printers, that is able to restore previous fan speed? It is needed for a tool change script to speed up tool changes with dual extruders.

Here and S3D example but would be useful for Cura as well:

M107 ; turn off fan
{IF NEWTOOL=0}M109 S[extruder0_temperature] T0; Set and wait for T0 extruder temperature
{IF NEWTOOL=1}M109 S[extruder1_temperature] T1; Set and wait for T0 extruder temperature
; Here gcode command to restore previous temperature without hardcoding it

Tried M106 R2 but that turns on to 100% fan speed, instead of the previous fan speed.
Last edited by jlund on Tue Oct 16, 2018 7:57 am, edited 1 time in total.
@home: Printrbot Jr. V2 kit, Lulzbot Mini, Flexystruder V2, Prusa I3 MK3 kit
@work: Lulzbot TAZ6, Flexydually V2

Galadriel
Aleph Objects | LulzBot
Posts: 271
Joined: Mon Sep 25, 2017 10:23 am

Re: g-code to restore previos fan speed

Post by Galadriel » Fri Oct 12, 2018 8:12 am

The M106 command should be what you need it will just need some additional coding along with it. I am not an expert with GCode by any means but this page might be helpful: http://marlinfw.org/docs/gcode/M106.html

It says that "M106 P<fan> T1 restores the previous fan speed."

jlund
Posts: 61
Joined: Tue Jul 12, 2016 12:31 pm

Re: g-code to restore previos fan speed

Post by jlund » Fri Oct 12, 2018 1:44 pm

Thanks! I am guessing it is P0 but I will see when testing it.
@home: Printrbot Jr. V2 kit, Lulzbot Mini, Flexystruder V2, Prusa I3 MK3 kit
@work: Lulzbot TAZ6, Flexydually V2

jlund
Posts: 61
Joined: Tue Jul 12, 2016 12:31 pm

Re: g-code to restore previous fan speed

Post by jlund » Mon Oct 29, 2018 8:35 am

Tried

M106 T1

Unfortunately did not work - it always seem to restore the print fan speed to 255.

S3D example snippet, where the slicer at tool change changes temperature on the extruders and fan, and run the tool change script:

Code: Select all

[snip ...]
; layer 17, Z = 1.600
M104 S265 T0
M104 S160 T1
M106 S76
G1 X0 F4000 	; Tool change script Move to wait for temperatures
M107		; Tool change script Turn off fan to speed up extruder heating
M109 S265 T0	; Tool change script Set extruder temperature and wait
M106 T1		; Tool change script Restore previous fan speed
T0
; tool H0.200 W0.720
; ooze shield
[... snip]
The slicer change the dual extruder temperatures and set the fan speed just before running the tool change script. So in this case the fan should return to M106 S76, but instead "returns" to 100% seen in the TAZ6 display.
@home: Printrbot Jr. V2 kit, Lulzbot Mini, Flexystruder V2, Prusa I3 MK3 kit
@work: Lulzbot TAZ6, Flexydually V2

Post Reply