Prusaslicer M107 start code disabling thermostatic extruder fan?



  • Duet 3, RRF 3.01 RC10

    Moving over to Prusaslicer from Cura and my functioning start gcode is misbehaving weirdly.

    I can slice the same part and the Cura gcode works as intended, with thermostatic fan turning as the firmware commands at 45c. With the same start gcode, the Prusaslicer file somehow lets the hotend heat all the way up without the fan on.

    The only significant difference (that I can see) in the .gcode files between the two is that Prusaslicer inserts a M107 at the very beginning (before the actual user-start gcode). Cura has the same M107, but it's inserted after the start gcode.

    Hotend fan config.g

    M950 F0 C"out4" Q16000                       ; create fan 0 on pin out4 and set its frequency
    M106 P0 S1 H1 T45             		         ; set fan 0 name and value. Thermostatic control is turned on
    

    Prusaslicer

    M107
    T0
    M190 S60 ; wait for bed temp
    M104 S210 ; set extruder temp
    M109 S210 ; wait for extruder temp
    M82 ;absolute extrusion
    G28  ;Home
    G29 S1  ; load mesh
    G1 Y5 ; move to front edge
    G1 Z0.28 F100  ; nozzle to extrusion height
    G1 E5  ; make a little blob
    G1 X150.0 E15 F500.0 ; purge line
    G92 E0 ; zero extruder
    G1 Z1
    G21 ; set units to millimeters
    G90 ; use absolute coordinates
    M82 ; use absolute distances for extrusion
    G92 E0
    

    Cura

    T0
    M190 S60
    M104 S210
    M109 S210
    M82 ;absolute extrusion mode
    G28 ;Home
    G29 S1 ; load mesh
    G1 Y5  ; move to front edge
    G1 Z0.28 F100  ; nozzle to extrusion height
    G1 E5  ; make a little blob
    G1 X150.0 E15 F500.0 ; purge line
    G92 E0 ; zero extruder
    G1 Z1
    G1 F3000 E-0.8
    ;LAYER_COUNT:100
    ;LAYER:0
    M107
    ;MESH:20mm_cube.stl
    

    The weird catch is that I removed the M107 from the Prusaslicer file and it worked as intended, with the hotend fan turning on at 45c during the M109 S210 command.



  • This post is deleted!


  • Do you select T0 at the bottom of your config.g?

    Perhaps it has something to do with M107 being called prior to T0 being called.



  • I don't, but I can put it in there.

    Interestingly, while swapping the fan numbers seems to have solved the problem on the file start,
    I lied, it's not fixed. Apparently it's an intermittent problem which is just lovely.

    I just finished a test print and the M107 that Prusaslicer sticks at the end of the file (before the user end gcode) will still kill the extruder fan before it's below the threshold.



  • @hypnolobster You seem to be getting confused about hot end heat sink cooling fans and part cooling fans. By default, the part cooling fan is fan 0 but you can change to different fan in the tool definition. https://duet3d.dozuki.com/Wiki/Gcode#Section_M563_Define_or_remove_a_tool

    If you think about it, part cooling fans cannot be set to thermostatic control because it makes no sense to alter the fan behaviour based on what the hot heater is doing. You want to vary the fan speed depending on what feature of the object is being printed. So slicers insert M106 Snn commands in the gcode file (or M107 to turn the fan off). By default, these commands will apply to fan 0 unless, as I said before, you tell the firmware to use a different fan when you define the tool.

    Heat sink cooling fans on the other hand, benefit from being controlled thermostatically and in which case, these are associated with heaters. So by default, fan 1 is usually assigned to the hot end heater which is heater 1.



  • Yeah. I went through various fan changes and they were assigned oddly (but functioning, for months).

    I just changed them back to part cooling on 0 and the hotend on 1.
    I thought that fixed the weird behavior but it doesn't seem like it actually did.

    For reference, this is the entirety of my config.g

    ; General preferences
    G90                                          ; send absolute coordinates...
    M83                                          ; ...but relative extruder moves
    M550 P"Sk-Go"                                ; set printer name
    
    M667 S1                                      ; select CoreXY mode
    
    ; Network
    M552 P0.0.0.0 S1                             ; enable network and acquire dynamic address via DHCP
    M586 P0 S1                                   ; enable HTTP
    M586 P1 S0                                   ; disable FTP
    M586 P2 S0                                   ; disable Telnet
    
    ; Drives
    M569 P0.0 S1                                 ; physical drive 0.0 goes forwards
    M569 P0.1 S1                                 ; physical drive 0.1 goes forwards
    M569 P0.2 S0                                 ; physical drive 0.2 goes forwards
    M569 P0.3 S1                                 ; physical drive 0.3 goes forwards
    M584 X0.0 Y0.1 Z0.2 E0.3                     ; set drive mapping
    M350 X16 Y16 Z8 E16 I1                       ; configure microstepping with interpolation
    M92 X200.00 Y200.00 Z800.00 E409.00          ; set steps per mm
    M566 X700.00 Y700.00 Z60.00 E2500.00      	 ; set jerk (mm/min)
    M203 X12000.00 Y12000.00 Z900.00 E3600.00    ; set max speed (mm/min)
    M201 X1200.00 Y1200.00 Z140.00 E2500.00      ; set acceleration (mm/s^2)
    M906 X800 Y800 Z800 E600 I30                 ; set motor currents (mA) and motor idle factor in per cent
    M84 S30                                      ; Set idle timeout
    M572 D0 S0.06						    	 ; set pressure advance	(0.085 formerly for PLA, 0.4 nozzle)
    ;M593 F40  									 ; cancel ringing at xHz
    
    ; Axis Limits
    M208 X0 Y0 Z0 S1                             ; set axis min
    M208 X305 Y300 Z300 S0                       ; set axis max
    
    ; Endstops
    M574 X1 S3                                   ; configure sensorless endstop for low end on X
    M574 Y1 S3                                   ; configure sensorless endstop for low end on Y
    M574 Z1 S2                                   ; configure Z-probe endstop for low end on Z
    
    ; Z-Probe
    M950 S0 C"io7.out"                           ; create servo pin 0 for BLTouch
    M558 P9 C"io7.in" H5 F120 T9000              ; Z probe type to bltouch and the dive height + speeds
    G31 P500 X31 Y10 Z2.28                       ; z probe trigger						 
    M557 X31:280 Y15:290 P6                      ; define mesh grid
    M376 H5										 ; taper compensation over 5mm
    
    ; Bed Heater
    M308 S0 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin temp1
    M950 H0 C"out1" T0                           ; create bed heater output on out1 and map it to sensor 0
    M143 H0 S120                                 ; set temperature limit for heater 0 to 120C
    M307 H0 B0 S1.00                             ; disable bang-bang mode for the bed heater and set PWM limit
    M140 H0                                      ; map heated bed to heater 0
    M307 H0 A115.0 C276.6 D1.5 V23.8 B0			 ; autotune result feb 28, 2020
    
    ;Extruder Heater
    M308 S1 P"temp2" Y"thermistor" T500000 B4723 C1.196220e-7 ; configure sensor 1 as thermistor on pin temp2
    M950 H1 C"out2" T1                           ; create nozzle heater output on out2 and map it to sensor 1
    M143 H1 S320                                 ; set temperature limit for heater 1 to 320C
    M307 H1 B0 S1.00                             ; disable bang-bang mode for heater  and set PWM limit
    M307 H1 A422.5 C138.4 D4.4 V23.8 B0		     ; autotune result april 11, 2020
    
    ; Extruder/Hotend Fan
    M950 F1 C"out4" Q16000                       ; create fan 1 on pin out4 and set its frequency
    M106 P1 S1 H1 T45             		         ; set fan 1 name and value. Thermostatic control is turned on
    
    ;Partcooling/Tool Fan
    M950 F0 C"out9" Q25000                       ; create fan 0 on pin out9 (servo/laser/pwm) and set its frequency
    M106 P0 S0 H-1 X0.35 B0.1                    ; set fan 0 name and value. Thermostatic control is turned off
    
    ; Tools
    M563 P0 D0 H1 F1 S"BMG-M Mosquito"           ; define tool 0
    G10 P0 X0 Y0 Z0                              ; set tool 0 axis offsets
    G10 P0 R0 S0                                 ; set initial tool 0 active and standby temperatures to 0C
    
    ; Miscellaneous
    M501                                         ; load saved parameters from non-volatile memory
    T0
    


  • Hah, yeah I think I was defining F1 on T0 and it was letting M106/M107 kill the thermostatic fan. I did have the hotend fan on F1, and the way cura sets up its files was apparently allowing that to work.

    I think it's actually fixed now.



  • @hypnolobster Yes, this is the line that was screwing things up....

    M563 P0 D0 H1 F1 S"BMG-M Mosquito"

    You defined fan 0 correctly to be the non thermostatic part cooling fan but then you effectively "mapped" fan 1 to fan 0 in that M563. So the firmware "thought" that fan 0 was both a non-thermostatic part cooling fan but also a thermostatically controlled heat sink fan. So no wonder you had strange things happening.

    You could either take the "F1" out of that M563 or replace "F1" with "F0" or swap F1 and F0 in both the M950 commands and leave the F1 in that M563. The latter would mean that fan1 is the part cooling fan and fan 0 is the hot end fan but that's a bit "hybrid" and doesn't achieve anything.

    In future, one way to remember is that non-thermostatic part cooling fans are associated with tools, but the thermostatic hot end cooling fans are associated with heaters (and heaters are assigned to tools).



  • @deckingman it's now Sept 22 and I just had the exact same problem. Thanks for posting this...

    Could we ask for an update to the Gcode wiki page for M563 to maybe go from:

    Fnnn Fan(s) to map fan 0 to (RepRapFirmware 1.16 and later)

    to

    Fnnn Part Cooling Fan(s) to map as fan 0 (RepRapFirmware 1.16 and later)


  • administrators

    The documentation page about connecting and configuring fans recommends that you use Fan 0 for the print cooling fan and Fan 1 for the thermostatic hot end fan, precisely to avoid this type of problem. I wish more users would read it.



  • This post is deleted!


  • @dc42 Really - I did read it and did set the fans up that way. The issue was not understanding which fan to use in the M563 command. I thought it would naturally be asking for the extruder fan there and "mapping as fan 0" in the doc didn't mean anything to me.


  • Moderator

    @markz
    https://duet3d.dozuki.com/Wiki/Connecting_and_configuring_fans

    Our intention is that in a 3D printer with a single print head, you use the Fan0 output for the print cooling fan and the Fan1 output for the heatsink fan. This is the easiest configuration to use because it's what the firmware expects by default.


  • administrators

    @markz said in Prusaslicer M107 start code disabling thermostatic extruder fan?:

    @dc42 Really - I did read it and did set the fans up that way. The issue was not understanding which fan to use in the M563 command. I thought it would naturally be asking for the extruder fan there and "mapping as fan 0" in the doc didn't mean anything to me.

    If you have only one print cooling fan and it is Fan 0 as recommended, then you don't need to use the F parameter in the M563 command. That parameter is only needed if different tools use different print cooling fans.


Log in to reply