Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sanmadjack/642d74622689fbe831174776c23687c7 to your computer and use it in GitHub Desktop.
Save sanmadjack/642d74622689fbe831174776c23687c7 to your computer and use it in GitHub Desktop.
Klipper Ender 6 Microswiss SKR Mini E3 V2.0 BLTouch SFS V2 Printer Config
################################################################
# Configuration for printer composed of:
# Creality Ender 6
# SKR Mini E3 v3 Mainboard
# Raspberry Pi 3 Model B Plus Rev 1.3
# Bltouch bed level sensor
# Micro Swiss NG™ Direct Drive Extruder for Creality Ender 6
# BTT SFS V2.0 Smart Filament Sensor
################################################################
# Custom macros are used to contain standardized code, slicer gcode calls these macros.
# The g-code below is used in Orca Slicer, but can be used in Prusa Slicer with minimal modifications.
# Start g-code is intended to use adaptive bed meshes, together with Orca Slicer's support.
# Omit PRINT_MIN, PRINT_MAX, MESH_ALGORITHM, and PROBE_COUNT to disable adaptive bed mesh.
# The load and unload macros don't work great (if at all), as the direct drive head really needs to be loaded and unloaded manually.
################################################################
# Start G-Code:
# SET_PRINT_STATS_INFO TOTAL_LAYER=[total_layer_count]
# START_PRINT EXTRUDER_TEMP={first_layer_temperature[0]} BED_TEMP={first_layer_bed_temperature[0]} PRINT_MIN={adaptive_bed_mesh_min[0]},{adaptive_bed_mesh_min[1]} PRINT_MAX={adaptive_bed_mesh_max[0]},{adaptive_bed_mesh_max[1]} MESH_ALGORITHM=[bed_mesh_algo] PROBE_COUNT={bed_mesh_probe_count[0]},{bed_mesh_probe_count[1]}
################################################################
# End g-code:
# END_PRINT MAX_Z={first_layer_print_max[2]}
# ; total layers count = [total_layer_count]
################################################################
# Before layer change g-code:
# ;BEFORE_LAYER_CHANGE
# ;[layer_z]
# G92 E0
################################################################
# After layer change g-code:
# ;AFTER_LAYER_CHANGE
# SET_PRINT_STATS_INFO CURRENT_LAYER={layer_num + 1}
# ;{layer_z}
################################################################
# Change gilament g-code:
# PAUSE
################################################################
# Pause g-code:
# M0
################################################################
[include mainsail.cfg]
[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC0
position_endstop: 260
position_min: 0
position_max: 260
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PC11
tx_pin: PC10
uart_address: 0
run_current: 0.580
[stepper_y]
step_pin: PB10
dir_pin: PB2
enable_pin: !PB11
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC1
position_endstop: 260
position_min: 0
position_max: 260
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PC11
tx_pin: PC10
uart_address: 2
run_current: 0.580
[stepper_z]
step_pin: PB0
dir_pin: !PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
#position_endstop: 0.0
#endstop_pin: ^PC2
endstop_pin: probe:z_virtual_endstop # enable to use BLTouch
position_min: -5 # enable to use BLTouch
position_max: 400
[tmc2209 stepper_z]
uart_pin: PC11
tx_pin: PC10
uart_address: 1
run_current: 0.580
[safe_z_home] # enable for BLTouch
home_xy_position: 150.7, 137
speed: 100
z_hop: 10
z_hop_speed: 5
[bltouch] # enable for BLTouch
sensor_pin: ^PC14
control_pin: PA1
x_offset: -50
y_offset: -7
speed: 3.0
[bed_mesh] # enable for BLTouch
speed: 100
mesh_min: 50, 7
mesh_max: 210, 243
algorithm: bicubic
probe_count: 5,5
[extruder]
step_pin: PB3
dir_pin: PB4
enable_pin: !PD1
microsteps: 16
rotation_distance: 7.84
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
min_temp: 0
max_temp: 300
max_extrude_only_distance: 1000.0
pressure_advance: 0.03
[tmc2209 extruder]
uart_pin: PC11
tx_pin: PC10
uart_address: 3
run_current: 0.650
# The switch sensor cable (red/blue) is plugged into EO-STOP (PC15),
# and the motion sensor cable (green/black) into PWR-DET (PC12).
# This is becayse PWR-DET doesn't provide power, while E0-STOP provides 5V,
[filament_switch_sensor filament_sensor_presence]
switch_pin: PC15
pause_on_runout: False
runout_gcode:
FILAMENT_RUNOUT
# insert_gcode:
# M117 Filament switch inserted
[filament_motion_sensor filament_sensor_motion]
switch_pin: PC12
detection_length: 10
extruder: extruder
pause_on_runout: False
runout_gcode:
FILAMENT_RUNOUT
# insert_gcode:
# M117 Filament encoder inserted
[heater_bed]
heater_pin: PC9
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC4
min_temp: 0
max_temp: 130
[heater_fan heatbreak_cooling_fan]
pin: PC7
heater_temp: 50.0
[temperature_fan mcu_fan]
pin: PB15
sensor_type: temperature_mcu
sensor_mcu: mcu
control: watermark
min_temp: 10
max_temp: 65
target_temp: 25
[fan]
pin: PC6
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_1700250012504B5735313920-if00
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 5
max_temp: 100
# [temperature_sensor mcu_temp]
# sensor_type: temperature_mcu
# sensor_mcu: mcu
# min_temp: 0
# max_temp: 100
[printer]
kinematics: corexy
max_velocity: 500
max_accel: 2000
max_z_velocity: 10
max_z_accel: 100
[screws_tilt_adjust]
screw1: 85,55
screw1_name: front left screw
screw2: 260,55
screw2_name: front right screw
screw3: 260,220
screw3_name: rear right screw
screw4: 85,220
screw4_name: rear left screw
horizontal_move_z: 10.
speed: 50.
screw_thread: CW-M3
[virtual_sdcard]
path: ~/printer_data/gcodes
[display_status]
[pause_resume]
[respond]
[save_variables]
filename: ~/printer_data/variables.cfg # UPDATE THIS FOR YOUR PATH!!!
[exclude_object]
[gcode_macro SCREW_TILT]
gcode:
G28
SCREWS_TILT_CALCULATE
# [gcode_macro LINEAR_ADVANCE]
# gcode:
# {% if 'K' in params %}
# {% if 'E' in params %}
# SET_PRESSURE_ADVANCE EXTRUDER={E} ADVANCE={K}
# {% else %}
# SET_PRESSURE_ADVANCE ADVANCE={K}
# {% endif %}
# {% endif %}
[gcode_macro POWEROFF]
gcode:
RESPOND TYPE=command MSG=action:poweroff
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
{% set PRINT_MIN = params.PRINT_MIN|default([printer.toolhead.axis_minimum.x,printer.toolhead.axis_minimum.y] | join(","))|string %}
{% set PRINT_MAX = params.PRINT_MAX|default([printer.toolhead.axis_maximum.x,printer.toolhead.axis_maximum.y] | join(","))|string %}
{% set MESH_ALGORITHM = params.MESH_ALGORITHM|default("lagrange")|string %}
{% set PROBE_COUNT = params.PROBE_COUNT|default("5,5")|string %}
RESPOND TYPE=echo MSG='Min print: {PRINT_MIN}'
RESPOND TYPE=echo MSG='Max print: {PRINT_MAX}'
# Start bed heating
RESPOND TYPE=echo MSG='Heating bed to: {BED_TEMP}'
M140 S{BED_TEMP}
# set temporary nozzle temp to prevent oozing during homing
#M104 S150
G90 ; use absolute coordinates
M83 ; extruder relative mode
M104 S150 ; set temporary nozzle temp to prevent oozing during homing
M140 S{BED_TEMP} ; set final bed temp
G4 S20 ; allow partial nozzle warmup
G28 ; home all axis
# Generate bed mesh
{% if PRINT_MAX == "260.0,260.0" %}
RESPOND TYPE=echo MSG='Performing normal bed mesh calibration'
BED_MESH_CALIBRATE
{% else %}
RESPOND TYPE=echo MSG='Performing adaptive bed mesh calibration'
BED_MESH_CALIBRATE mesh_min={PRINT_MIN} mesh_max={PRINT_MAX} ALGORITHM={MESH_ALGORITHM} PROBE_COUNT={PROBE_COUNT} ADAPTIVE=1 ADAPTIVE_MARGIN=0
{% endif %}
#BED_MESH_PROFILE LOAD=default
G1 Z50 F240
RESPOND TYPE=echo MSG='Heating extruder to: {EXTRUDER_TEMP}'
M104 S{EXTRUDER_TEMP} ; set final nozzle temp
M190 S{BED_TEMP} ; wait for bed temp to stabilize
M109 S{EXTRUDER_TEMP} ; wait for nozzle temp to stabilize
#PURGE_LINE BED_TEMP={BED_TEMP} EXTRUDER_TEMP={EXTRUDER_TEMP}
G92 E0
# Not doing purge line anymore
# [gcode_macro PURGE_LINE]
# gcode:
# {% set BED_TEMP = params.BED_TEMP|default(60)|float %}
# {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
# # set final nozzle temp
# M104 S{EXTRUDER_TEMP}
# {% set PURGE_MARGIN = 10 %}
# {% set PURGE_Y_MIN = printer.toolhead.axis_minimum.y + PURGE_MARGIN %}
# {% set PURGE_Y_MAX = printer.toolhead.axis_maximum.y - PURGE_MARGIN %}
# {% set PURGE_E_LENGTH = (10/130)*(PURGE_Y_MAX-PURGE_Y_MIN) %}
# RESPOND TYPE=echo MSG='Purge Y Rangs: {PURGE_Y_MIN} to {PURGE_Y_MAX}'
# # Move the nozzle to the purge position
# G1 Z50 F240
# G1 X2.0 Y{PURGE_Y_MIN} F3000
# # wait for bed temp to stabilize
# M190 S{BED_TEMP}
# # wait for nozzle temp to stabilize
# M109 S{EXTRUDER_TEMP}
# {% set PURGE_LENGTH = 2 %}
# G1 Z0.28 F240
# G92 E0
# G1 X2.0 Y{PURGE_Y_MAX} E{PURGE_E_LENGTH} F1500 ; prime the nozzle
# # Move nozzle to the side for return purge
# G1 X2.3 Y{PURGE_Y_MAX} F5000
# G92 E0
# G1 X2.3 Y{PURGE_Y_MIN} E{PURGE_E_LENGTH} F1200 ; prime the nozzle
# G92 E0
[gcode_macro END_PRINT]
gcode:
# Turn off bed, extruder, and fan
M140 S0
M104 S0
M106 S0
# Move nozzle away from print while retracting
G91
G1 X-2 Y-2 E-3 F300
# Raise nozzle by 10mm
G1 Z10 F3000
PRESENT_PRINT_BED
G90
# Disable steppers
M84
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
variable_park: True
gcode:
## Move head and retract only if not already in the pause state and park set to true
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
TURN_OFF_HEATERS
CLEAR_PAUSE
#SDCARD_RESET_FILE
BASE_CANCEL_PRINT
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
#SET_IDLE_TIMEOUT TIMEOUT={timeout}
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro PRESENT_PRINT_BED]
description: Lowers the print bed to a human-friendly height
gcode:
{% set PRINT_MAX_Z = printer.toolhead.axis_maximum.z|float %}
{% set COMFORT_POINT = 320|float %}
{% set CURRENT_Z = printer.toolhead.position.z|float %}
{% set HEAD_MARGIN = 20|float %}
{% set TOOL_FRONT = params.TOOL_FRONT|default(0)|int %}
{% set HEAD_MOVE_SPEED = 10000|int %}
RESPOND TYPE=echo MSG='Max Z: {PRINT_MAX_Z}'
RESPOND TYPE=echo MSG='Comfort point: {COMFORT_POINT}'
RESPOND TYPE=echo MSG='Current Z: {CURRENT_Z}'
{% if CURRENT_Z < COMFORT_POINT %}
{% set TARGET_Z = COMFORT_POINT %}
{% else %}
{% set TARGET_Z = CURRENT_Z + HEAD_MARGIN %}
{% if TARGET_Z > PRINT_MAX_Z %}
{% set TARGET_Z = PRINT_MAX_Z %}
{% endif %}
{% endif %}
RESPOND TYPE=echo MSG='Target Z: {TARGET_Z}'
; move print head out of the way
{% if TOOL_FRONT==1 %}
{% set TARGET_X = HEAD_MARGIN %}
{% set TARGET_Y = HEAD_MARGIN %}
{% else %}
{% set TARGET_X = printer.toolhead.axis_maximum.x-HEAD_MARGIN %}
{% set TARGET_Y = printer.toolhead.axis_maximum.y-HEAD_MARGIN %}
{% endif %}
G90 ; Set to absolute positioning
{% if TARGET_Z != CURRENT_Z %}
G1 X{TARGET_X} Y{TARGET_Y} Z{TARGET_Z} F{HEAD_MOVE_SPEED}
{% else %}
G1 X{TARGET_X} Y{TARGET_Y}
{% endif %}
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
[gcode_macro M600]
gcode:
SAVE_GCODE_STATE NAME=M600_state
PAUSE
RESTORE_GCODE_STATE NAME=M600_state
# Moves the print head away, slightly retracts filament
[gcode_macro FILAMENT_RUNOUT]
gcode:
SAVE_GCODE_STATE NAME=FILAMENT_RUNOUT_state
PAUSE
RESTORE_GCODE_STATE NAME=FILAMENT_RUNOUT_state
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 10.0
gcode:
{% set timeout = printer.configfile.settings.idle_timeout.timeout %}
{ "SET_IDLE_TIMEOUT TIMEOUT=3600" if timeout < 3600 }
##### set park positon for x and y #####
# default is your max position from your printer.cfg
# {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
# {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
# {% set z_park_delta = 5.0 %}
{% set x_park = 15 %}
{% set y_park = 15 %}
{% set z_park_delta = 50 %}
##### calculate safe lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E-{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
;G91
;G1 Z{z_safe} F900
;G90
;G1 X{x_park} Y{y_park} F6000
PRESENT_PRINT_BED TOOL_FRONT=1
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(220)|float %}
M104 S{EXTRUDER_TEMP}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
G1 X125 Y50 Z80 ; move to servicing position
M118 E1 Waiting for nozzle to heat
M109 S{EXTRUDER_TEMP}
M118 E1 Retracting filament
M83 ; set extruder to relative
G1 E10 F300 ; extrude a little to soften tip
G1 E-10 F3000 ; jerk the filament out of the melt zone
M104 S0 ; Set nozzle temp to zero
#G1 E-800 F1800 ; retract the rest of the way
#G1 E-100 F900 ; retract the rest of the way
G1 E-100 F900 ; retract from the hotend
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
M400
M118 E1 Unload done
[gcode_macro LOAD_FILAMENT]
gcode:
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(220)|float %}
M104 S{EXTRUDER_TEMP}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
G1 X125 Y50 Z80 ; move to servicing position
M118 E1 Waiting for nozzle to heat
M109 S{EXTRUDER_TEMP}
M118 E1 Advancing filament
M83 ; set extruder to relative
G1 E50 F150 ; prime nozzle with filament
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
M400
M118 E1 Load done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment