Skip to content

Instantly share code, notes, and snippets.

@Scarsz
Created February 8, 2023 09:07
Show Gist options
  • Save Scarsz/2d7c0d465d087c021b57b5170fe5e625 to your computer and use it in GitHub Desktop.
Save Scarsz/2d7c0d465d087c021b57b5170fe5e625 to your computer and use it in GitHub Desktop.
Klipper printer.cfg for my Ender 3 S1 (upgraded hot end, higher max temperature)
[include mainsail.cfg]
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA5
position_min: -14
position_endstop: -14
position_max: 241
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA6
position_min: -8
position_endstop: -8
position_max: 225
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 270
position_min: -4
[extruder]
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
gear_ratio: 42:12
rotation_distance: 26.359
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: pid
pid_Kp: 23.561
pid_Ki: 1.208
pid_Kd: 114.859
min_temp: 0
max_temp: 300
[filament_switch_sensor RunoutSensor]
pause_on_runout: False
runout_gcode: PAUSE
insert_gcode: RESUME
switch_pin: !PC15
[heater_bed]
heater_pin: PA7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
pid_Kp: 71.867
pid_Ki: 1.536
pid_Kd: 840.843
min_temp: 0
max_temp: 100
[heater_fan hotend_fan]
pin: PC0
[fan]
pin: PA0
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 2000
max_z_velocity: 5
max_z_accel: 100
max_accel_to_decel: 3000
square_corner_velocity: 5.0
[bltouch]
sensor_pin: ^PC14
control_pin: PC13
x_offset: -31.8
y_offset: -41.5
#speed: 10
#samples: 1
#samples_result: average
probe_with_touch_mode: true
stow_on_each_sample: false
[safe_z_home]
home_xy_position: 106, 117.5
speed: 50
z_hop: 10
z_hop_speed: 5
#move_to_previous: true
[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 1.2, 8.5
mesh_max: 209.2, 183.5
probe_count: 5, 5
fade_start: 1
fade_end: 10
[delayed_gcode bed_mesh_init]
initial_duration: .01
gcode:
BED_MESH_PROFILE LOAD=default
[temperature_sensor Board_MCU]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100
[temperature_sensor Raspberry_Pi]
sensor_type: temperature_host
min_temp: 0
max_temp: 100
[bed_screws]
screw1: 16, 26
screw1_name: front left
screw2: 190, 25
screw2_name: front right
screw3: 190, 195.5
screw3_name: back right
screw4: 16, 196
screw4_name: back left
[virtual_sdcard]
path: ~/printer_data/gcodes
[display_status]
[pause_resume]
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
# Start bed heating
M140 S{BED_TEMP}
# Use absolute coordinates
G90
# Reset the G-Code Z offset (adjust Z offset if needed)
SET_GCODE_OFFSET Z=0.0
# Home the printer
G28
# Move the nozzle near the bed
G1 Z5 F3000
# Move the nozzle very close to the bed
G1 Z0.15 F300
# Wait for bed to reach temperature
M190 S{BED_TEMP}
# Set and wait for nozzle to reach temperature
M109 S{EXTRUDER_TEMP}
[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
G90
# Disable steppers
M84
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.0
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
##### set park positon for x and y #####
# default is your max posion 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 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
#### 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' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 2.835
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.080000, -0.070000, -0.107500, -0.017500, -0.002500
#*# 0.020000, -0.092500, -0.087500, -0.015000, 0.005000
#*# 0.042500, -0.020000, -0.005000, 0.032500, 0.057500
#*# 0.015000, -0.040000, -0.030000, -0.000000, 0.052500
#*# 0.045000, 0.017500, -0.002500, 0.030000, 0.135000
#*# x_count = 5
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 1.1999999999999993
#*# max_x = 209.2
#*# min_y = 8.5
#*# max_y = 183.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment