Skip to content

Instantly share code, notes, and snippets.

@GeekAnnoyed
Created February 18, 2023 09:55
Show Gist options
  • Save GeekAnnoyed/3f69e187b7f508e3d5954105ee9aac01 to your computer and use it in GitHub Desktop.
Save GeekAnnoyed/3f69e187b7f508e3d5954105ee9aac01 to your computer and use it in GitHub Desktop.
# This file contains pin mappings for the stock 2020 Creality Ender 3
# V2. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), 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 end in ".bin" and must not match the last filename
# that was flashed.
# See docs/Config_Reference.md for a description of parameters.
[virtual_sdcard]
path: /home/pi/printer_data/gcodes
[display_status]
[display] # RET6 12864 LCD
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PB10
click_pin: ^!PB2
[pause_resume]
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 0
position_max: 245
homing_speed: 50
[stepper_y]
position_min: -8 #most Ender 3 configs have this wrong. Between the nozzle and the bed is a gap of 8mm (Y dimension) when the printer is homed. If not adapt this and the -8 in the Probe_In Makro).
position_endstop: -8
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_max: 200
homing_speed: 50
[stepper_z]
position_min: -8 # set a negative value (minimum as the probe z_offset)
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
#position_endstop: 10
endstop_pin = probe:z_virtual_endstop
position_max = 240
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 34.406
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: pid
# tuned for stock hardware with 200 degree Celsius target
pid_Kp: 21.527
pid_Ki: 1.063
pid_Kd: 108.982
min_temp: 0
max_temp: 250
[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
# tuned for stock hardware with 50 degree Celsius target
pid_Kp: 54.027
pid_Ki: 0.770
pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PA0
[mcu]
serial: /dev/ttyUSB0
restart_method: command
[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
##################################
## Add this to your printer.cfg ##
##################################
#####################################################################
# KlackEnder- Settings
#####################################################################
# !! Change your Z endstop pin from 'endstop_pin: Pin123' to 'endstop_pin: probe:z_virtual_endstop'
# !! Also add in [stepper_y] 'position_min: -8'. Idk why but most configs mave this wrong. For the Stock Ender 3 the homed Y position is -8.
[probe]
pin: ^PC14 #Probe-Stop Connection on Skr Mini E3 V1.2
z_offset: 0 #Measure per your specific setup
x_offset: 4 # negative = left of the nozzle
y_offset: 21 # negative = in front of of the nozzle
speed: 5.0
lift_speed: 15.0
sample_retract_dist: 1
samples: 2
samples_tolerance_retries: 6
##[(7x7)-1] / 2 = 24
##[(5x5)-1] / 2 = 12
[bed_mesh]
speed: 300
horizontal_move_z: 2
mesh_min: 8,30
mesh_max: 223,201
probe_count: 5,5
relative_reference_index: 12
algorithm: bicubic
fade_start: 1
fade_end: 10
#fade_target:
# The z position in which fade should converge. When this value is set
# to a non-zero value it must be within the range of z-values in the mesh.
# Users that wish to converge to the z homing position should set this to 0.
# Default is the average z value of the mesh.
split_delta_z: 0.015
# The amount of Z difference (in mm) along a move that will
# trigger a split. Default is .025.
move_check_distance: 3
# The distance (in mm) along a move to check for split_delta_z.
# This is also the minimum length that a move can be split. Default
# is 5.0.
mesh_pps: 4,4
# A comma separated pair of integers (X,Y) defining the number of
# points per segment to interpolate in the mesh along each axis. A
# "segment" can be defined as the space between each probed
# point. The user may enter a single value which will be applied
# to both axes. Default is 2,2.
#bicubic_tension: .2
# When using the bicubic algorithm the tension parameter above
# may be applied to change the amount of slope interpolated.
# Larger numbers will increase the amount of slope, which
# results in more curvature in the mesh. Default is .2.
[homing_override]
set_position_z:0 # Make printer think Z axis is at zero, so we can force a move upwards away from build plate
gcode:
G90
G1 Z10 F3000 ; move up to prevent accidentally scratching build plate
G28 X
G28 Y
PROBE_OUT
G1 X117 Y117 F6000
G28 Z
PROBE_IN
#####################################################################
# KlackEnder- Macros
#####################################################################
[gcode_macro PROBE_OUT]
gcode:
G90
G1 X245 F4000
G4 P300
G1 Z15
G1 X0
[gcode_macro PROBE_IN]
gcode:
G90
G1 Z20
G1 X245 F20000
G1 Y-8
G1 Z0
G4 P300
G1 X220 F6000
G1 Z10
G1 X0
[gcode_macro AUTO_BED_MESH]
gcode:
PROBE_OUT
BED_MESH_CALIBRATE
#G1 Y0 F20000
PROBE_IN
[gcode_macro G29]
gcode:
PROBE_OUT
BED_MESH_CALIBRATE
#G1 Y0 F20000
PROBE_IN
[gcode_macro Accuracy_Test]
gcode:
PROBE_OUT
G90
G1 Y120 X120 F20000
PROBE_ACCURACY
PROBE_IN
[gcode_macro AUTO_Z_TILT_ADJUST]
gcode:
PROBE_OUT
Z_TILT_ADJUST
PROBE_IN
#####################################################################
# KlackEnder- Menu
#####################################################################
[menu __main]
type: list
name: Main
[menu __main __KlackEnder]
type: list
enable: True
name: KlackEnder
[menu __main __KlackEnder __ProbeOut]
type: command
name: Probe Out
gcode:
PROBE_OUT
[menu __main __KlackEnder __ProbeIn]
type: command
name: Probe In
gcode:
PROBE_IN
[menu __main __KlackEnder __AutoBedMesh]
type: command
name: Auto Bed Mesh
gcode:
G28
AUTO_BED_MESH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment