Klipper CR10s Pro v2 Config w/BL Touch and Micro Swiss + Minimus

# This file contains pin mappings for the Creality CR-10S Pro V2. To use
# this config, the firmware should be compiled for the AVR atmega2560.

[bltouch]
sensor_pin: ^PD2
control_pin: PB5
x_offset: -48.9
y_offset: -5.7
pin_move_time: 0.4
stow_on_each_sample: False
probe_with_touch_mode: True
samples: 1
sample_retract_dist: 3.0
#speed: 4.0
#Usually you think of the z offset as a negative number as closer, because you baby step down after starting at zero
#this is opposite - this is the probe offset
#Higher the offset, the closer the nozzle will be to the bed
#Lower the offset, the further the nozzle will be from the bed
#take current baby stepped z-offset and multiply by -1 (inverse it's sign) and add it to the current offset to get new offset value
#for example:
#  current z_offset = 1.50 and needed to baby step down -.05 then new value should be 1.55
#  current z_offset = 1.50 and needed to baby step up +.05 then new value should be 1.45
#If you need more squish, increase the offset.
#If the nozzle is too close, lower the offset.
z_offset = 3.70

[gcode_macro G29]
gcode:
  BED_MESH_CALIBRATE
  G90
  G1 X15 Y15 Z15

[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 15,  25
mesh_max: 250, 285
probe_count: 5,5
algorithm: bicubic
fade_start: 1
fade_end: 10
fade_target: 0


[bed_screws]
screw1: 80,55
screw2: 305,55
screw3: 305,290
screw4: 80,290

[screws_tilt_adjust]
screw1: 80,290
screw1_name: rear left screw
screw2: 80,55
screw2_name: front left screw
screw3: 300,55
screw3_name: front right screw
screw4: 300,290
screw4_name: rear right screw
horizontal_move_z: 10
speed: 50
screw_thread: CW-M4

;[input_shaper]
;shaper_freq_x: 43.0
;shaper_type_x: mzv
;shaper_freq_y: 28.8
;shaper_type_y: mzv

#[mcu rpi]
#serial: /tmp/klipper_host_mcu

#[adxl345]
#cs_pin: rpi:None

#[resonance_tester]
#accel_chip: adxl345
#probe_points:
#    155,155,20  # an example

[virtual_sdcard]
path: ~/printer_data/gcodes

[display_status]

[pause_resume]

[stepper_x]
step_pin: PF0
dir_pin: PF1
enable_pin: !PD7
rotation_distance: 40
microsteps: 16
full_steps_per_rotation: 200
endstop_pin: ^PE5
position_endstop: 0
position_min: 0
position_max: 300
homing_speed: 50
homing_retract_dist: 5

[stepper_y]
step_pin: PF6
dir_pin: !PF7
enable_pin: !PF2
rotation_distance: 40
microsteps: 16
full_steps_per_rotation: 200
endstop_pin: ^PJ1
position_endstop: 0
position_min: 0
position_max: 310
homing_speed: 50
homing_retract_dist: 5

[stepper_z]
step_pin: PL3
dir_pin: !PL1
enable_pin: !PK0
rotation_distance: 8
microsteps: 16
full_steps_per_rotation: 200
endstop_pin: probe:z_virtual_endstop
position_min: -8
position_max: 351

[extruder]
step_pin: PA4
dir_pin: !PA6
enable_pin: !PA2
rotation_distance: 22.900
microsteps: 16
full_steps_per_rotation: 200
nozzle_diameter: 0.400
filament_diameter: 1.750
max_extrude_only_distance: 500.0
max_extrude_only_velocity: 70.0
max_extrude_only_accel: 1000.0
heater_pin: PB4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK5
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_extrude_temp: 170
min_temp: 5
max_temp: 275

[heater_bed]
heater_pin: PH5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK6
control: pid
pid_Kp: 690.34
pid_Ki: 111.47
pid_Kd: 1068.83
min_temp: 5
max_temp: 140

[fan]
pin: PH6

[mcu]
serial: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AR0JSH3K-if00-port0

[printer]
kinematics: cartesian
max_velocity: 200
max_accel: 1500
max_z_velocity: 10
max_z_accel: 100

[safe_z_home]
home_xy_position: 177,155
speed: 80.0
z_hop: 10.0
z_hop_speed: 5.0

[filament_switch_sensor e0_sensor]
switch_pin: PE4
pause_on_runout: False
runout_gcode:
  PAUSE_PARK

[pause_resume]

[respond]
default_type: echo

[t5uid1]
firmware: dgus_reloaded
machine_name: CR-10S Pro V2
volume: 60
brightness: 50
z_min: 0
z_max: 350

[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.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	  0.345000, 0.250000, 0.180000, 0.120000, 0.245000
#*# 	  0.310000, 0.165000, 0.100000, 0.077500, 0.142500
#*# 	  0.290000, 0.120000, 0.020000, 0.035000, 0.115000
#*# 	  0.330000, 0.180000, 0.087500, 0.090000, 0.137500
#*# 	  0.442500, 0.240000, 0.182500, 0.142500, 0.212500
#*# tension = 0.2
#*# min_x = 15.0
#*# algo = bicubic
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 25.0
#*# x_count = 5
#*# max_y = 285.0
#*# mesh_x_pps = 2
#*# max_x = 249.99999999999997
#*#
#*# [extruder]
#*#
#*# [heater_bed]
#*#
#*# [bltouch]