Skip to content

Instantly share code, notes, and snippets.

@nickgarvey
Created May 11, 2022 04:55
Show Gist options
  • Select an option

  • Save nickgarvey/b52aa81e0ef14dca58a501880d07df46 to your computer and use it in GitHub Desktop.

Select an option

Save nickgarvey/b52aa81e0ef14dca58a501880d07df46 to your computer and use it in GitHub Desktop.
# This file contains pin mappings for the stock 2021 Creality Ender 3
# S1. To use this config, check the STM32 Chip on the V2.4S1 Board
# then during "make menuconfig" select either the STM32F103 with a
# "28KiB bootloader" or select the STM32F401 with a "64KiB bootloader"
# and serial (on USB PA10/PA9) communication for both depending on the
# STM32 Chip installed on your printers Motherboard.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USB PA10/PA9), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must changed to "firmware.bin"
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
full_steps_per_rotation: 200
rotation_distance: 40
endstop_pin: !PA5
position_endstop: 0
position_min: -10
position_max: 230
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
full_steps_per_rotation: 200
rotation_distance: 40
endstop_pin: !PA6
position_endstop: 0
position_min: -8
position_max: 220
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: -5
[extruder]
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
gear_ratio: 3.5:1
rotation_distance: 26.3585
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: 250
[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: 110
[heater_fan hotend_fan]
pin: PC0
heater: extruder
heater_temp: 50.0
[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
[bltouch]
sensor_pin: ^PC14
control_pin: PC13
x_offset: -30.5
y_offset: -40.5
#z_offset: 0
probe_with_touch_mode: true
stow_on_each_sample: false
[bed_mesh]
speed: 120
mesh_min: 20, 20
mesh_max: 195, 179
probe_count: 4,4
algorithm: bicubic
[safe_z_home]
home_xy_position: 147, 154
speed: 75
z_hop: 5
z_hop_speed: 5
move_to_previous: true
[filament_switch_sensor e0_sensor]
switch_pin: !PC15
pause_on_runout: true
runout_gcode: PAUSE
[pause_resume]
recover_velocity: 25
[virtual_sdcard]
path: ~/gcode_files
[display_status]
[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.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 22.744
#*# pid_ki = 1.213
#*# pid_kd = 106.613
#*#
#*# [bltouch]
#*# z_offset = 3.180
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.030000, 0.007500, 0.045000, 0.117500
#*# -0.002500, -0.005000, 0.007500, 0.087500
#*# -0.035000, -0.015000, 0.030000, 0.105000
#*# -0.050000, -0.032500, -0.020000, 0.080000
#*# tension = 0.2
#*# min_x = 20.0
#*# algo = bicubic
#*# y_count = 4
#*# mesh_y_pps = 2
#*# min_y = 20.0
#*# x_count = 4
#*# max_y = 179.0
#*# mesh_x_pps = 2
#*# max_x = 194.99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment