## Thermistor types [extruder] and [heater_bed] sections - See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types
## Z Endstop Switch location [safe_z_home] section
## Homing end position [gcode_macro G32] section
## Z Endstop Switch offset for Z0 [stepper_z] section
## Probe points [quad_gantry_level] section
## Min & Max gantry corner postions [quad_gantry_level] section
# This part fetches data from your slicer. Such as bed temp, extruder temp, chamber temp and size of your printer.
{% set target_bed=params.BED|int %}
{% set target_extruder=params.EXTRUDER|int %}
{% set target_chamber=params.CHAMBER|default("40")|int %}
{% set x_wait=printer.toolhead.axis_maximum.x|float / 2 %}
{% set y_wait=printer.toolhead.axis_maximum.y|float / 2 %}
{% set FL_SIZE=params.SIZE|default("0_0_0_0")|string %}
# Homes the printer, sets absolute positioning and updates the Stealthburner leds.
#STATUS_HOMING # Sets SB-leds to homing-mode
G28 # Full home (XYZ)
G90 # Absolut position
## Uncomment for bed mesh (1 of 2)
#BED_MESH_CLEAR # Clears old saved bed mesh (if any)
SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" # Displays info
#STATUS_HEATING # Sets SB-leds to heating-mode
M106 S255 # Turns on the PT-fan
# ## Uncomment if you have a Nevermore.
# #SET_PIN PIN=nevermore VALUE=1 # Turns on the nevermore
G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed
M190 S{target_bed} # Sets the target temp for the bed
{% if target_bed|int > 90 %}
SET_DISPLAY_TEXT MSG="Soak for 5min" # Displays info
G4 P60000 # Waits 5 min for the bedtemp to stabilize
SET_DISPLAY_TEXT MSG="Soak for 4min" # Displays info
G4 P60000 # Waits 5 min for the bedtemp to stabilize
SET_DISPLAY_TEXT MSG="Soak for 3min" # Displays info
G4 P60000 # Waits 5 min for the bedtemp to stabilize
SET_DISPLAY_TEXT MSG="Soak for 2min" # Displays info
G4 P60000 # Waits 5 min for the bedtemp to stabilize
SET_DISPLAY_TEXT MSG="Soak for 1min" # Displays info
G4 P60000 # Waits 5 min for the bedtemp to stabilize
{% endif %}
{% if printer.extruder.temperature < 160|float %}
# Heating nozzle to 150 degrees. This helps with getting a correct Z-home
SET_DISPLAY_TEXT MSG="Hotend: 150c" # Displays info
M109 S150 # Heats the nozzle to 150c
{% endif %}
# Uncomment for V2 (Quad gantry level AKA QGL)
SET_DISPLAY_TEXT MSG="QGL" # Displays info
#STATUS_LEVELING # Sets SB-leds to leveling-mode
QUAD_GANTRY_LEVEL # Levels the buildplate via QGL
G28 Z # Homes Z again after QGL
## Uncomment for Klicky auto-z
#CALIBRATE_Z # Calibrates Z-offset with klicky
#SET_DISPLAY_TEXT MSG="Z-offset" # Displays info
## Uncomment for bed mesh (2 of 2)
#SET_DISPLAY_TEXT MSG="Bed mesh" # Displays info
#STATUS_MESHING # Sets SB-leds to bed mesh-mode
#BED_MESH_CALIBRATE ADAPTIVE=1 # Starts bed mesh
#ADAPTATIVE_BED_MESH SIZE={FL_SIZE} # Adaptative bed mesh from here: https://github.com/The-Conglomerate/Voron-Klipper-Common/blob/main/macros/adaptive_bed_mesh.cfg
# Heats up the nozzle up to target via data from slicer
SET_DISPLAY_TEXT MSG="Hotend: {target_extruder}c" # Displays info
#STATUS_HEATING # Sets SB-leds to heating-mode
G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed
M107 # Turns off partcooling fan
M109 S{target_extruder} # Heats the nozzle to printing temp
# enable filament sensor
SFS_ENABLE
# Gets ready to print by doing a purge line and updating the SB-leds
SET_DISPLAY_TEXT MSG="Printer goes brr" # Displays info
#STATUS_PRINTING # Sets SB-leds to printing-mode
G0 X{x_wait - 50} Y4 F10000 # Moves to starting point
G0 Z0.4 # Raises Z to 0.4
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.5 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.5 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.9 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.9 Y20 Z0.3 F1500.0 E15 ; Draw the second line
pause_on_runout: True ; This can be set to false to debug false positives putting the sensor in "monitor mode". The printer will not pause but it will run the runout_gcode below.
event_delay: 3.0
pause_delay: 0.5
runout_gcode:
M117 Runout Detected!
[delayed_gcode DISABLEFILAMENTSENSOR] ; This will disable the SFS 1 second after klipper starts
initial_duration: 1
gcode:
SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=0 ; Put your filament sensor's name after SENSOR=
[gcode_macro SFS_ENABLE] ; Add this to PRINT_START
description: Enable smart filament sensor
gcode:
M117 ENABLING the Smart Filament Sensor
G92 E0
SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=1 ; Put your filament sensor's name after SENSOR=
[gcode_macro SFS_DISABLE] ; Add this to PRINT_END and PRINT_CANCEL
description: Disable smart filament sensor
gcode:
M117 DISABLING the Smart Filament Sensor
G92 E0
SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=0 ; Put your filament sensor's name after SENSOR=
description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU
gcode:
# Speed
{% set speed=params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations=params.ITERATIONS|default(5)|int %}
# Acceleration
{% set accel=params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Minimum Cruise Ratio
{% set min_cruise_ratio=params.MIN_CRUISE_RATIO|default(0.5)|float %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound=params.BOUND|default(20)|int %}
# Size for small pattern box
{% set smallpatternsize=SMALLPATTERNSIZE|default(20)|int %}
# Large pattern
# Max positions, inset by BOUND
{% set x_min=printer.toolhead.axis_minimum.x %}
{% if x_min < 0 %}
{% set x_min=0 %}
{% endif %}
{% set y_min=printer.toolhead.axis_minimum.y %}
{% if y_min < 0 %}
{% set y_min=0 %}
{% endif %}
{% set x_min=x_min + bound %}
{% set x_max=printer.toolhead.axis_maximum.x - bound %}
{% set y_min=y_min + bound %}
{% set y_max=printer.toolhead.axis_maximum.y - bound %}
# Small pattern at center
# Find X/Y center point
{% set x_center=(printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
{% set y_center=(printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
# Set small pattern box around center point
{% set x_center_min=x_center - (smallpatternsize/2) %}
{% set x_center_max=x_center + (smallpatternsize/2) %}
{% set y_center_min=y_center - (smallpatternsize/2) %}
{% set y_center_max=y_center + (smallpatternsize/2) %}
# Save current gcode state (absolute/relative, etc)
# QGL if not already QGLd (only if QGL section exists in config)
{% if printer.configfile.settings.quad_gantry_level %}
{% if printer.quad_gantry_level.applied== False %}
QUAD_GANTRY_LEVEL
G28 Z
{% endif %}
{% endif %}
# Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24)