Klipper Ender 3 Config w/Bigtreetech SKR Mini E3 v3.0, BLTouch, MicroSwiss


[gcode_macro G29]
gcode:
  ;BED_MESH_CALIBRATE
  BED_MESH_PROFILE LOAD=MESHFIFTY
  ;BED_MESH_PROFILE LOAD=MESHSIXTY
  ;BED_MESH_PROFILE LOAD=MESHFORTY
  G90
  G1 X15 Y15 Z15
  
[bltouch]
sensor_pin: PC2
control_pin: PA1
x_offset: -44
y_offset: -7
#Higher the offset, the closer to the bed the nozzle will be.
#Lower the offset, the further the nozzle will be.
#If you need more squish or if it's too high, increase the offset.
#If it's too close, lower the offset.
z_offset: 1.78
#z_offset: 1.62
pin_move_time: 0.4
probe_with_touch_mode: True
pin_up_touch_mode_reports_triggered: False
stow_on_each_sample: False

[bed_mesh]
speed: 50
horizontal_move_z: 5
mesh_min: 44, 44
mesh_max: 191, 191
probe_count: 3, 3
mesh_pps: 2,2

[input_shaper]
shaper_freq_x: 64.4
shaper_type_x: mzv
shaper_freq_y: 38.0
shaper_type_y: mzv

[bed_screws]
screw1: 30,30
screw2: 200,30
screw3: 200,200
screw4: 30,200

[screws_tilt_adjust]
screw1: 70.5,37.5
screw1_name: front left screw
screw2: 240,37.5
screw2_name: front right screw
screw3: 240,207.5
screw3_name: rear right screw
screw4: 70.5,207.5
screw4_name: rear left screw
horizontal_move_z: 10
speed: 50
screw_thread: CW-M4

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

#[adxl345]
#cs_pin: rpi:None

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

[safe_z_home]
home_xy_position: 162, 125
speed: 80.0
z_hop: 10.0
z_hop_speed: 10.0

[virtual_sdcard]
path: ~/gcode_files

[display_status]

[pause_resume]

[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC0
position_endstop: -5
position_min: -5
position_max: 240
homing_speed: 50

[tmc2209 stepper_x]
uart_pin: PC11
tx_pin: PC10
uart_address: 0
run_current: 0.580
stealthchop_threshold: 999999


[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 16
rotation_distance: 40
position_endstop: 0
endstop_pin: ^PC1
position_endstop: -25
position_min: -25
position_max: 240
homing_speed: 50

[tmc2209 stepper_y]
uart_pin: PC11
tx_pin: PC10
uart_address: 2
run_current: 0.580
stealthchop_threshold: 999999


[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
#endstop_pin: PC2
#position_endstop: 0.0
position_max: 250
position_min: -2

[tmc2209 stepper_z]
uart_pin: PC11
tx_pin: PC10
uart_address: 1
run_current: 0.580
stealthchop_threshold: 999999

[extruder]
step_pin: PB3
dir_pin: !PB4
enable_pin: !PD1
microsteps: 16
#PLA
rotation_distance: 23.45
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
control: pid
pid_Kp: 21.527
pid_Ki: 1.063
pid_Kd: 108.982
min_temp: 0
max_temp: 280

[tmc2209 extruder]
uart_pin: PC11
tx_pin: PC10
uart_address: 3
run_current: 0.650
stealthchop_threshold: 999999

[heater_bed]
heater_pin: PC9
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC4
control: pid
pid_Kp: 54.027
pid_Ki: 0.770
pid_Kd: 948.182
min_temp: 0
max_temp: 130

[heater_fan controller_fan]
pin: PB15
heater: heater_bed
heater_temp: 45.0

[heater_fan nozzle_cooling_fan]
pin: PC7

[fan]
pin: PC6

[mcu]
serial: /dev/ttyAMA0
restart_method: command

[board_pins]
aliases:
    # EXP1 header
    EXP1_1=PB5,  EXP1_3=PA9,   EXP1_5=PA10, EXP1_7=PB8,  EXP1_9=<GND>,
    EXP1_2=PA15, EXP1_4=<RST>, EXP1_6=PB9,  EXP1_8=PB15, EXP1_10=<5V>

[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 5000
max_z_velocity: 5
max_z_accel: 100

[display]
lcd_type: emulated_st7920
spi_software_miso_pin: PD8 # status led, Virtual MISO
spi_software_mosi_pin: PD6
spi_software_sclk_pin: PB9
en_pin: PB8
encoder_pins: ^PA10, ^PA9
click_pin: ^!PA15

[output_pin beeper]
pin: PB5

[gcode_macro CALIBRATEBED90]
gcode:
  M190 S90
  G28
  BED_MESH_CALIBRATE PROFILE=MESHNINETY
  BED_MESH_PROFILE SAVE=MESHNINETY
  ;SAVE_CONFIG ;save to config file

[gcode_macro CALIBRATEBED60]
gcode:
  M190 S60
  G28
  BED_MESH_CALIBRATE PROFILE=MESHSIXTY
  BED_MESH_PROFILE SAVE=MESHSIXTY
  ;SAVE_CONFIG ;save to config file

[gcode_macro CALIBRATEBED50]
gcode:
  M190 S50
  G28
  BED_MESH_CALIBRATE PROFILE=MESHFIFTY
  BED_MESH_PROFILE SAVE=MESHFIFTY
  ;SAVE_CONFIG ;save to config file

[gcode_macro CALIBRATEBED40]
gcode:
  M190 S40
  G28
  BED_MESH_CALIBRATE PROFILE=MESHFORTY
  BED_MESH_PROFILE SAVE=MESHFORTY
  ;SAVE_CONFIG ;save to config file

   
[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