# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".

# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR
# mini E3 with that SD card.

# See docs/Config_Reference.md for a description of parameters.

# Note: This board has a design flaw in its thermistor circuits that
# cause inaccurate temperatures (most noticeable at low temperatures).

# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30
# En om bij de clips vandaan te blijven wordt er aan Y nog 21 toegevoegd.

# Voor het verplaatsen van de X en/of Y is het nodig om Z 2.0 mm omhoog te zetten. Hierdoor komt de kop boven de clipjes en kunnen de clipjes op hun plaats blijven zitten.
# Dit wordt geregeld in PRINT_START in start_end.cfg en in HOMING in kinematics.cfg.

# Invoegen van de standaard macros, geknipt uit printer.cfg
#[include macros/standaardMacros.cfg]
# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros
[include macros/jschuh_macros.cfg]
[include scherm/menu.cfg]
[include leds/neopixel.cfg]

[exclude_object]

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

[tmc2209 stepper_x]
uart_pin: PB15
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250

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

[tmc2209 stepper_y]
uart_pin: PC6
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250

[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: ^PC2
position_endstop: 0
position_min: -2
position_max: 250

[tmc2209 stepper_z]
uart_pin: PC10
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 5

[bltouch]
sensor_pin: ^PC14
control_pin: PA1
#pin_up_reports_not_triggered: False
#pin_up_touch_mode_reports_triggered: False
x_offset: 32.3
y_offset: -33.5
#z_offset: 2.68
pin_move_time: 0.680

[bed_screws]
screw1: 29,31
screw2: 196,31
screw3: 196,206
screw4: 29,206
#screw5: 117,117

[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 25,10
mesh_max: 228.7,126.5
probe_count: 5,5

[extruder]
# DropEffect OmniaDrop V2.1
step_pin: PB3
dir_pin: PB4
enable_pin: !PD2
microsteps: 16
gear_ratio: 5:1
rotation_distance: 32.160
max_extrude_cross_section: 3.0
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: 285

[tmc2209 extruder]
uart_pin: PC11
run_current: 0.500
hold_current: 0.400
stealthchop_threshold: 5

[heater_fan my_nozzle_fan]
# Aansturing via PT-DET pinout
pin: PC12
heater: extruder
heater_temp: 50.0
fan_speed: 1.0

[heater_bed]
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC3
#control: pid
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130

[fan]
pin: PA8

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

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

[static_digital_output usb_pullup_enable]
pins: !PC13

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

# See the sample-lcd.cfg file for definitions of common LCD displays.

[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

[output_pin beeper]
pin: EXP1_1

[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT

[display_status]

[mcu rpi]
serial: /tmp/klipper_host_mcu

[adxl345]
cs_pin: rpi:None

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

### input-shaper waardes verkregen via adxl345 tuning
[input_shaper]
shaper_freq_x: 69.8
shaper_type_x: mzv
shaper_freq_y: 41.4
shaper_type_y: ei

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 31.285
#*# pid_ki = 2.343
#*# pid_kd = 104.414
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 63.394
#*# pid_ki = 0.394
#*# pid_kd = 2550.799
#*#
#*# [bltouch]
#*# z_offset = 2.675
#*#
#*# [stepper_z]
#*#
#*# [bed_mesh GlasbedCarbonBoven]
#*# version = 1
#*# points =
#*# 	0.250000, 0.085000, 0.025000, -0.015000, -0.027500
#*# 	0.192500, 0.072500, 0.015000, -0.015000, -0.045000
#*# 	0.052500, -0.032500, -0.037500, -0.050000, 0.015000
#*# 	-0.030000, -0.017500, 0.025000, 0.072500, 0.117500
#*# 	0.032500, 0.005000, 0.042500, 0.032500, 0.127500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh GlasbedCarbonBoven	]
#*# version = 1
#*# points =
#*# 	0.030000, -0.065000, -0.075000, -0.145000, -0.165000
#*# 	0.272500, 0.092500, -0.070000, -0.275000, -0.422500
#*# 	0.027500, -0.052500, -0.075000, -0.165000, -0.160000
#*# 	-0.045000, -0.040000, -0.045000, -0.105000, -0.057500
#*# 	0.017500, 0.005000, 0.022500, -0.012500, 0.002500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 	-0.327500, -0.370000, -0.362500, -0.365000, -0.490000
#*# 	-0.285000, -0.327500, -0.385000, -0.417500, -0.482500
#*# 	-0.442500, -0.385000, -0.335000, -0.302500, -0.357500
#*# 	-0.460000, -0.382500, -0.365000, -0.307500, -0.282500
#*# 	-0.405000, -0.302500, -0.257500, -0.222500, -0.240000
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
