Ender 5 pro Skr 1.4 Turbo Config

Ender 5 Pro NOT PLUS, but can probably be used with out screen and adjusting the Z motor positions in Z tilt
Skr 1.4 T board
2209 drivers
auto temp main fain to HE1
BD Sensor
This has a Dual Belt Z but can easily be changed to single Z or back to lead screws
Using stock Ender 5 screen
BTT V2 Filament Sensor
The axis limits will need tweaked for your setup, my frame is modified for my X Y movement to get full 235 bed

[gcode_macro G28] #updated for BDsensor, really don't need if you have a different homing option
rename_existing: G990028
gcode:
      {% if rawparams|length == 0 %}
           { action_respond_info("homing all") }
           G990028 X Y
           ## Homing with contactless probe with the homing_speed in [stepper_z]
           BDSENSOR_SET COLLISION_HOMING=0
           G990028 Z
           ## Homing with contact probe with the second_homing_speed in [stepper_z]
           BDSENSOR_SET COLLISION_HOMING=1
           G990028 Z
      {% else %}
            {% if 'x' in rawparams or 'X' in rawparams  %}
                 { action_respond_info("homing x") }
                 G990028 X
            {% endif %}
            {% if 'y' in rawparams or 'Y' in rawparams  %}
                 { action_respond_info("homing y") }
                 G990028 Y
            {% endif %}
            {% if 'z' in rawparams or 'Z' in rawparams  %}
                 { action_respond_info("homing z") }
                 ## Homing with contactless probe with the homing_speed in [stepper_z]
                 BDSENSOR_SET COLLISION_HOMING=0
                 G990028 Z
                 ## Homing with contact probe with the second_homing_speed in [stepper_z]
                 BDSENSOR_SET COLLISION_HOMING=1
                 G990028 Z
            {% endif %}
      {% endif %}

[gcode_macro M300]
# Used for beep tones
gcode:
    {% set S = params.S|default(260)|int %} ; S sets the tone frequency
    {% set P = params.P|default(100)|int %} ; P sets the tone duration
    {% set L = 0.85 %} ; L varies the PWM on time, close to 0 or 1 the tone gets a bit quieter. 0.5 is a symmetric waveform
    {% if S <= 0 %} ; dont divide through zero
        {% set F = 1 %}
        {% set L = 0 %}
    {% elif S >= 10000 %} ;max frequency set to 10kHz
        {% set F = 1/10000 %}
    {% else %}
        {% set F = 1/S %} ;convert frequency to seconds  
    {% endif %}
      SET_PIN PIN=BEEPER_pin VALUE={L} CYCLE_TIME={F} ;Play tone
      G4 P{P} ;tone duration
      SET_PIN PIN=BEEPER_pin VALUE=0

[gcode_macro M155] #for the BDSENSOR distance from bed, useful for tramming
description: read and display distance on the screen on a 'S'chedule.
variable_repeat_timer: 0
gcode:
  {% if 'S' in params %}
  {% set seconds = params.S|int %}
    #RESPOND MSG="time in seconds:"{seconds}
    SET_GCODE_VARIABLE MACRO=M155 VARIABLE=repeat_timer VALUE={seconds}
    UPDATE_DELAYED_GCODE ID=respond_temp_timer DURATION={seconds}
  {% endif %}
  
[delayed_gcode respond_temp_timer]
initial_duration: 0
gcode:
#    {% set time = params.VALUE|int %}
#    RESPOND MSG="time2 in seconds:"{params.REPEAT}%
    M102 S-2
    UPDATE_DELAYED_GCODE ID=respond_temp_timer DURATION={printer['gcode_macro M155'].repeat_timer}

[save_variables]
filename: /home/Ender5_data/config/variables.cfg

[mcu]
serial: /dev/serial/by-id/usb-Klipper_lpc1769_#find your mcu ID

[filament_switch_sensor switch_sensor]
switch_pin: P1.25
pause_on_runout: False
runout_gcode:
#  M117 Filament switch empty!
#  _RUN_OUT # [pause_resume] is required in printer.cfg
insert_gcode:
 # M117 Filament switch full!

[filament_motion_sensor encoder_sensor]
switch_pin: P1.26
detection_length: 2.88
extruder: extruder
pause_on_runout: False
runout_gcode:
#  _RUN_OUT # [pause_resume] is required in printer.cfg
 # M117 Filament encoder runout
insert_gcode:
 # M117 Filament encoder inserted

[virtual_sdcard]
path: /home/Ender5_data/gcodes #find your path
on_error_gcode: CANCEL_PRINT

[printer]
kinematics: cartesian
max_velocity: 1000
max_accel: 1500
max_z_velocity: 5
max_z_accel: 50

[safe_z_home]
home_xy_position = 146, 117
speed = 150
z_hop = 5
z_hop_speed = 5

[heater_fan hotend]
pin: P2.4
heater: extruder
heater_temp: 50

[stepper_x]
step_pin: P2.2
dir_pin: P2.6
enable_pin: !P2.1
microsteps: 16
rotation_distance: 40
endstop_pin: P1.29
position_endstop: 253
position_max: 253
position_min: -15
homing_speed: 75

[stepper_y]
step_pin: P0.19
dir_pin: !P0.20
enable_pin: !P2.8
microsteps: 16
rotation_distance: 40
endstop_pin: P1.28
position_endstop: 249
position_min: 0
position_max: 249
homing_speed: 75

[stepper_z]
step_pin: P0.22
dir_pin: P2.11
enable_pin: !P0.21
microsteps: 16
rotation_distance: 5
endstop_pin: probe:z_virtual_endstop
position_min: -4
position_max: 289
homing_speed: 8
second_homing_speed: 2  #set this to 3 if homing with collision
homing_retract_speed: 2
homing_retract_dist:0

[stepper_z1]
step_pin: P1.15
dir_pin: !P1.14
enable_pin: !P1.16
microsteps: 16
rotation_distance: 5

[extruder]
step_pin: P2.13
dir_pin: !P0.11
enable_pin: !P2.12
microsteps: 16
rotation_distance: 7.68
nozzle_diameter: 0.400
filament_diameter: 1.750
max_extrude_cross_section: 1.6
#   Maximum area (in mm^2) of an extrusion cross section (eg,
#   extrusion width multiplied by layer height). This setting prevents
#   excessive amounts of extrusion during relatively small XY moves.
#   If a move requests an extrusion rate that would exceed this value
#   it will cause an error to be returned. The default is: 4.0 *
#   nozzle_diameter^2
instantaneous_corner_velocity: 1.000
#   The maximum instantaneous velocity change (in mm/s) of the
#   extruder during the junction of two moves. The default is 1mm/s.
max_extrude_only_distance: 250.0
heater_pin: P2.7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: P0.24
control: pid
pid_Kp: 26.724
pid_Ki: 1.310
pid_Kd: 136.292
min_temp: 0
max_temp: 285

[heater_bed]
heater_pin: P2.5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: P0.25
control: pid
pid_Kp: 71.979 
pid_Ki: 1.206 
pid_Kd: 1074.288
min_temp: 0
max_temp: 100

[fan]
pin: P2.3

[z_tilt]
z_positions:
  117, 280
  117, -93
points:
  146, 225
  146, 15
speed: 100
horizontal_move_z: 5
retries: 5
retry_tolerance: 0.01

########################################
# TMC2209 configuration
########################################

[tmc2209 stepper_x]
uart_pin: P1.10
run_current: 0.800
stealthchop_threshold: 9999 
#
[tmc2209 stepper_y]
uart_pin: P1.9
run_current: 0.800
stealthchop_threshold: 9999 
#
[tmc2209 stepper_z]
uart_pin: P1.8
run_current: 0.600
stealthchop_threshold: 9999
#
[tmc2209 extruder]
uart_pin: P1.4
run_current: 0.850
stealthchop_threshold: 9999 
#
[tmc2209 stepper_z1]
uart_pin: P1.1
run_current: 0.600
stealthchop_threshold: 9999

########################################
# EXP1 / EXP2 (display) pins
########################################

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=<GND>,
    EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>,
    # EXP2 header
    EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=<GND>,
    EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=<RST>, EXP2_10=<NC>
    # Pins EXP2_1, EXP2_6, EXP2_2 are also MISO, MOSI, SCK of bus "ssp0"

[display]
lcd_type: st7920
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2

[pwm_cycle_time BEEPER_pin]
pin: EXP1_1
value: 0
shutdown_value: 0
cycle_time: .01
scale: 1

## Z options (bd sensor)

[bed_screws]
screw1: 32, 203
screw2: 203, 203
screw3: 203, 32
screw4: 32, 32

[screws_tilt_adjust]
screw1: 74, 220
screw1_name: back left screw
screw2: 253, 220
screw2_name: back right screw
screw3: 253, 49
screw3_name: front right screw
screw4: 74, 49
screw4_name: front left screw
horizontal_move_z: 10.
speed: 50.
screw_thread: CW-M4

[bed_mesh]
speed: 120
horizontal_move_z: 1
mesh_min: 21, 15
mesh_max: 221, 220
probe_count: 12, 12
mesh_pps: 2, 2
algorithm: bicubic
bicubic_tension: 0.2
#fade_start: .8
#fade_end: 5
adaptive_margin: 5
 
[BDsensor] 
# Don't use aliases for the board pins
sda_pin: P0.10 # example of connecting to main board Creality V4.2.7
scl_pin: P2.0
#scl_pin:MKS_THR:gpio20 # example of connecting to CAN module like MKS THR42 
#sda_pin:MKS_THR:gpio11 
#scl_pin:host:gpio17 # example of connecting to GPIO on RaspberryPi
#sda_pin:host:gpio27
delay: 20 # you can set it 10 if the BDsensor version is >=1.2
z_offset: 0 #  within -0.6 to 0.6mm
z_adjust: 0
x_offset: -29
y_offset: 0
no_stop_probe: # fast probe that the toolhead will not stop at the probe point,disable it by commenting out.
position_endstop: 1.2 #the triggered position, recommend value is 1~2.8
collision_homing:1 #  set it 1 to enable homing with nozzle collision sensing.
collision_calibrate:1 # set it 1 to enable auto calibrate BDsensor with nozzle collision sensing.
speed: 3
#QGL_Tilt_Probe:0 #set 1 to enable probe up and down when do quad_gantry_level

[gcode_macro Z_TILT_ADJUST] 
#modified for bdsensor, runs two adjustments one while moving z up and down, and one with just moving the head and leaving bed still

description: Checks if Homed to prevent error when clicking Z tilt directly from UI
rename_existing: _Z_TILT_ADJUST
gcode:
  {% if printer.toolhead.homed_axes != "xyz" %}
    G28
  {% endif %}
  #run z tilt with z move up and down at first
    BDSENSOR_SET QGL_TILT_PROBE=1 #set this 1 to enable z axis up and down
    BDSENSOR_SET COLLISION_HOMING=0
    _Z_TILT_ADJUST horizontal_move_z=6 retry_tolerance=.02
    G28 Z0
    #run z tilt with no z move up and down
    BDSENSOR_SET QGL_TILT_PROBE=0 #set this 0 to disable z axis up and down while probe
    _Z_TILT_ADJUST horizontal_move_z=1 retry_tolerance=0.01
    #BDSENSOR_SET COLLISION_HOMING=1 #optional
    G28 Z0
  {% if params.SKIPPARK != "True" %}
    _TOOLHEAD_PARK_PAUSE_CANCEL
  {% endif %}