P1S End GCode Help

Hello All,

I’m trying to customize my end gcode to make the chamber/exhaust fan & the auxiliary fan run at 100% until the heatbed is below 40oC and then everything shuts off.

Here is my current end gcode from LECKIESTEIN using his Steinwipe feature. I’ve highlighted the lines I’ve added/edited on the R and the original gcode on the left. What’s currently happening is the correct fans set to 100% but then I immediately get error “HMS_0300-0100-0003-0008: The temperature of the heated bed exceeds the limit and automatically adjusts to the limit temperature.

The fans then stay on indefinitely at the end of the print and it never reaches 100%.

Original End gcode Edited End gcode
Original End gcode

;BBS_P1_Machine End G-code
;==========================================================
;----------------------LECKIESTEIN-------------------------
;==========================================================

;_SWMC Core_Apr.28.2025
;_Core Version_1
;_Released_Apr.30.2025

;____________ get off part _________________
M400 ; wait for buffer to clear
M104 S200 ; Start cooling hotend to min tool change temp
M106 S255
G0 E-[retraction_length[current_extruder]] F{retraction_speed[current_extruder] * 60} ; retract
M204 S20000
G0 F{500 * 60}
;_______________________ determin lift off part _______________________
{if z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3}
G17
G2 Z{max_layer_z + z_hop[0]} I0.86 J0.86 P1 ; spiral lift a little from second lift
{else}
G0 Z{max_layer_z + z_hop[0]}
{endif}
;_______ move to chute ____________
G0 X60 Y250 F{500 * 60}
G0 Y264.5 F3000

M140 S0 ; turn off bed
M106 P2 S0 ; turn off remote part cooling fan
M106 P3 S0 ; turn off chamber cooling fan

M622.1 S1 ; for prev firware, default turned on
M1002 judge_flag timelapse_record_flag
M622 J1
M400 ; wait all motion done
M991 S0 P-1 ;end smooth timelapse at safe pos
M400 S3 ;wait for last picture to be taken
M623; end of “timelapse_record_flag”

M400 ; wait all motion done
M17 S
M17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom
{if (max_layer_z + 100.0) < 250}

G1 Z{max_layer_z + 100.0} F600
G1 Z{max_layer_z +98.0}

{else}

G1 Z250 F600
G1 Z248

{endif}
M400
{if printer_notes !~ /.^(leave_filament_in_end_print)$./}
M620 S255 ; if AMS avail retract
; retract to prevent tool change push down in FW
{if printer_notes =~ /.^(steinretraction_low)$./}
G0 E-8 F{retraction_speed[current_extruder] * 60}
{elsif printer_notes =~ /.^(steinretraction_med)$./}
G0 E-12 F{retraction_speed[current_extruder] * 60}
{elsif printer_notes =~ /.^(steinretraction_max)$./}
G0 E-16 F{retraction_speed[current_extruder] * 60}
{endif}
M400 P250
G0 X20 Y20 F{500 * 60} ; Jog to cut position
G0 Y-3 ; cut position entry point
T255
G0 X60 Y264.5 ; needed only for slicer display - tool already in the chute
M621 S255
{endif}
M400

M109 S175 ; wait until hotend is cool to wipe to fully remove string
M204 S20000
G0 F{500 * 60}
G0 X130
;__Move to wiper pad entry position
G0 X161.3 Y261.3 ; go to wiper entry position
M104 S0
M106 S0
{template_custom_gcode}
G0 Y250
G0 X60
G0 Y264.5 F3000

M17 R ; restore z current

M220 S100 ; Reset feedrate magnitude
M201.2 K1.0 ; Reset acc magnitude
M73.2 R1.0 ;Reset left time magnitude
M1002 set_gcode_claim_speed_level : 0

{if printer_notes =~ /.^(disable_motors_end_print)$./}
M18
{else}
M17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power
{endif}

Edited End g-code (changes highlighted)

;BBS_P1_Machine End G-code
;==========================================================
;----------------------LECKIESTEIN-------------------------
;==========================================================

;_SWMC Core_Apr.28.2025
;_Core Version_1
;_Released_Apr.30.2025

;____________ get off part _________________
M400 ; wait for buffer to clear
M104 S200 ; Start cooling hotend to min tool change temp
M106 P1 S255
M106 P2 S255
M106 P3 S255

G0 E-[retraction_length[current_extruder]] F{retraction_speed[current_extruder] * 60} ; retract
M204 S20000
G0 F{500 * 60}
;_______________________ determin lift off part _______________________
{if z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3}
G17
G2 Z{max_layer_z + z_hop[0]} I0.86 J0.86 P1 ; spiral lift a little from second lift
{else}
G0 Z{max_layer_z + z_hop[0]}
{endif}
;_______ move to chute ____________
G0 X60 Y250 F{500 * 60}
G0 Y264.5 F3000

M140 S0 ; turn off bed

M622.1 S1 ; for prev firware, default turned on
M1002 judge_flag timelapse_record_flag
M622 J1
M400 ; wait all motion done
M991 S0 P-1 ;end smooth timelapse at safe pos
M400 S3 ;wait for last picture to be taken
M623; end of “timelapse_record_flag”

M400 ; wait all motion done
M17 S
M17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom
{if (max_layer_z + 100.0) < 250}

G1 Z{max_layer_z + 100.0} F600
G1 Z{max_layer_z +98.0}

{else}

G1 Z250 F600
G1 Z248

{endif}
M400
{if printer_notes !~ /.^(leave_filament_in_end_print)$./}
M620 S255 ; if AMS avail retract
; retract to prevent tool change push down in FW
{if printer_notes =~ /.^(steinretraction_low)$./}
G0 E-8 F{retraction_speed[current_extruder] * 60}
{elsif printer_notes =~ /.^(steinretraction_med)$./}
G0 E-12 F{retraction_speed[current_extruder] * 60}
{elsif printer_notes =~ /.^(steinretraction_max)$./}
G0 E-16 F{retraction_speed[current_extruder] * 60}
{endif}
M400 P250
G0 X20 Y20 F{500 * 60} ; Jog to cut position
G0 Y-3 ; cut position entry point
T255
G0 X60 Y264.5 ; needed only for slicer display - tool already in the chute
M621 S255
{endif}
M400

M109 S175 ; wait until hotend is cool to wipe to fully remove string
M204 S20000
G0 F{500 * 60}
G0 X130
;__Move to wiper pad entry position
G0 X161.3 Y261.3 ; go to wiper entry position
M104 S0
M106 P1 S0
{template_custom_gcode}
G0 Y250
G0 X60
G0 Y264.5 F3000

M17 R ; restore z current

M220 S100 ; Reset feedrate magnitude
M201.2 K1.0 ; Reset acc magnitude
M73.2 R1.0 ;Reset left time magnitude
M1002 set_gcode_claim_speed_level : 0

M106 P3 S255; set Chamber fan to 100%
M106 P2 S255; set Aux fan to 100%
M190 R40; wait for bed temp to reach 40 degrees
M106 P2 S0; set Aux fan to 0%
M106 P3 S255; set Chamber fan to 0%
M140 S0; turn off heatbed

{if printer_notes =~ /.^(disable_motors_end_print)$./}
M18
{else}
M17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power
{endif}

Try changing M190 R40 to M190 S40

R40 means “exactly 40”

S40 means “at or below 40”

Nice to see another Leckiestein user on here!

Thanks. I’ll try it now and see what happens.

1 Like

It worked great!!! I ended up changing it to 45oC because 40 seems to take forever.

I also caught my mistake in the code that kept the chamber fan running. I have it set to keep P3 at 100% even though I want it to turn off at the end.

1 Like