KLP1/firmware/config/printer.cfg

654 lines
19 KiB
INI
Raw Normal View History

2024-08-31 17:35:33 +02:00
#####################################################################
# KINGROON KLP1 V2.2-230
####################################################################
[include mainsail.cfg]
[include MKS_THR.cfg]
[mcu]
serial:/dev/serial/by-id/usb-Klipper_stm32f103xe_BB6232333036341232383139-if00
restart_method: command
#####################################################################
# 速度
####################################################################
[printer]
kinematics:corexy#打印机类型
max_velocity: 500#最大速度
max_accel: 20000#最大加速度
max_accel_to_decel: 6000#最大加速度到减速度
max_z_velocity: 50#Z轴最大速度
max_z_accel: 100#Z轴最大加速度
square_corner_velocity: 20#方形拐角速度
#####################################################################
# 运动和驱动参数
####################################################################
[stepper_x]
step_pin:PC14 #电机脉冲引脚
dir_pin:!PC13 #方向设置
enable_pin:!PC15 #使能引脚
microsteps: 16 #细分
rotation_distance: 40 #主动轮周长mm
full_steps_per_rotation:200 #单圈脉冲数量
endstop_pin:tmc2209_stepper_x:virtual_endstop #限位开关接口
position_min: 0 #限位最小行程
position_endstop: 0 #回零的位置
position_max: 235 #最大限位行程
homing_speed:50 #回零速度
homing_retract_dist:0 #后撤距离
homing_positive_dir:False #回零方向
step_pulse_duration:0.000002
[stepper_y]
step_pin:PE5
dir_pin:PE4
enable_pin:!PD14
microsteps:16
rotation_distance: 40
full_steps_per_rotation:200
endstop_pin:tmc2209_stepper_y:virtual_endstop
position_min: 0
position_endstop:0
position_max:235
homing_speed:50
homing_retract_dist:0
homing_positive_dir:false
step_pulse_duration:0.000002
[stepper_z]
step_pin:PE1
dir_pin:PE0
enable_pin:!PE2
microsteps: 16
rotation_distance:8
full_steps_per_rotation: 200
gear_ratio: 40:20
endstop_pin:probe:z_virtual_endstop
position_max: 220
position_min: -10
homing_speed:5
second_homing_speed: 2
homing_positive_dir:false
step_pulse_duration:0.000002
[tmc2209 stepper_x]
uart_pin: PE6
run_current: 1.3
interpolate: True
stealthchop_threshold: 0 #静音模式quiet mode99999/高速模式High speed mode0
diag_pin:^PA14
driver_SGTHRS: 110
[tmc2209 stepper_y]
uart_pin: PE3
run_current: 1.3
interpolate: True
stealthchop_threshold: 0#静音模式quiet mode99999/高速模式High speed mode0
diag_pin:^PA15
driver_SGTHRS:110
[tmc2209 stepper_z]
uart_pin: PB7
run_current: 1.0
hold_current: 1.0
interpolate: True
stealthchop_threshold: 0#静音模式quiet mode99999/高速模式High speed mode0
#####################################################################
# 挤出机
#####################################################################
[extruder]
step_pin: MKS_THR:gpio5
dir_pin: !MKS_THR:gpio4
enable_pin: !MKS_THR:gpio10
rotation_distance:53.2
gear_ratio: 95:10 #减速比
microsteps: 16
full_steps_per_rotation: 200 #脉冲
nozzle_diameter: 0.400 # 喷嘴的孔径(以毫米为单位)
filament_diameter: 1.75 # 进入挤出机的耗材上标的直径(以毫米为单位)
heater_pin: MKS_THR:gpio2
sensor_pin: MKS_THR:gpio26
sensor_type: ATC Semitec 104GT-2
min_temp: 0 #最小温度
max_temp: 310 #最大温度
max_power: 1 #最大功率
min_extrude_temp: 60
control = pid
pid_kp = 19.837#发送命令PID_CALIBRATE HEATER=extruder TARGET=245 它将执行一个PID校准程序完成后控制台将返回PID数值将其复制到配置文件即可。
pid_ki = 4.723
pid_kd = 20.829
pressure_advance: 0.03 #压力提前数据 was 0.03
pressure_advance_smooth_time: 0.09
max_extrude_cross_section:0.64#500挤出线条横截面的最大面积以平方毫米为单位 例如挤出线宽乘层高这个设置能防止在相对较小的XY移动时产生过度的挤出默认值是4.0 * 喷嘴直径 ^ 2
instantaneous_corner_velocity: 20.000 #两次挤出之间最大的速度变化(以毫米每秒为单位)
max_extrude_only_distance: 100.0# 一次挤出或回抽的最大长度(以毫米耗材的长度为单位)
max_extrude_only_velocity:5000# 最大的挤出和回抽速度(以毫米每秒为单位)
max_extrude_only_accel:2000# 和加速度(以毫米每二次方秒为单位)
step_pulse_duration:0.000002
[tmc2209 extruder]
uart_pin: MKS_THR:gpio6
interpolate: True
run_current: 0.9
hold_current: 0.9
sense_resistor: 0.110
stealthchop_threshold:0
#####################################################################
# 回零动作
####################################################################
[homing_override]
set_position_z:0
gcode:
G91
G1 Z5 F100
{% set HOME_CUR = 0.500 %}
{% set driver_config = printer.configfile.settings['tmc2209 stepper_x'] %}
{% set RUN_CUR = driver_config.run_current %}
SET_VELOCITY_LIMIT ACCEL=500
# Set current for sensorless homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
{% if params.X is defined %}
{% if params.Y is undefined %}
{% if params.Z is undefined %}
G28 X F100
G1 X2 F1000
{% endif %}
{% endif %}
{% endif %}
{% if params.Y is defined %}
{% if params.X is undefined %}
{% if params.Z is undefined %}
G28 Y F100
G1 Y2 F1000
{% endif %}
{% endif %}
{% endif %}
{% if params.Z is defined %}
{% if params.X is undefined %}
{% if params.Y is undefined %}
G28 Z F100
{% endif %}
{% endif %}
{% endif %}
{% if params.X is defined %}
{% if params.Y is defined %}
{% if params.Z is undefined %}
G28 X F100
G28 Y F100
G1 X2 F1000
G1 Y2 F1000
{% endif %}
{% endif %}
{% endif %}
{% if params.X is undefined %}
{% if params.Y is undefined %}
{% if params.Z is undefined %}
G28 X F100
G28 Y F100
G1 X30 F2000
G1 Y15 F1000
G28 Z F100
G1 Z10 F100
{% endif %}
{% endif %}
{% endif %}
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}
SET_VELOCITY_LIMIT ACCEL=5000
G90
BED_MESH_PROFILE LOAD=default
#####################################################################
# 热床
####################################################################
[heater_bed]
heater_pin: PA0
sensor_type: NTC 100K MGB18-104F39050L32
sensor_pin: PC0
max_power: 1
#control = pid
#pid_kp = 57.862
#pid_ki = 2.167
#pid_kd = 386.231
min_temp: 0
max_temp: 200
#####################################################################
# 风扇
####################################################################
[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100
[temperature_sensor KINGROONpi Pi]
sensor_type: temperature_host
min_temp: 0
max_temp: 100
[temperature_fan Pi_fan2]#主板温控风扇
pin:PA2
kick_start_time: 0.500
sensor_type: temperature_host
##control: watermark
# 高于以下温度启用风扇
##target_temp: 30.0# 允许的温度范围
##min_temp: 0
##max_temp: 90# 调节最大风速以降低噪音 设置值30-100
##max_speed: 1
##min_speed: 0.3
##https://klp1.com/issues/silence-motherboard-fan/
control: pid
pid_kp: 10
pid_ki: 0
pid_kd: 0
# Temperature which it will try to target
target_temp: 60.0
# Absolute limits for temperature
min_temp: 0
max_temp: 90
# Adjust the interval for the fan speed to the range 0%-100%
max_speed: 1.0
min_speed: 0.0
####################################################################
# 一键预热
#####################################################################
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(220)|float %}
M140 S{BED_TEMP}#加热热床到目标温度
M104 S{EXTRUDER_TEMP}
M190 S{BED_TEMP}
M109 S{EXTRUDER_TEMP}
G90
G28
## https://klipper.discourse.group/t/klipper-does-not-appear-to-be-using-mesh-ender-3v2n/9615
BED_MESH_PROFILE LOAD="default"
G1 Z5 F3000
G1 Z0.15 F100
[gcode_macro M205]
gcode:
[gcode_macro END_PRINT]
gcode:
G91
G1 X-2 Y-2 E-3 F300
G1 Z10 F3000
G90
M84
M140 S60
M104 S200
M106 S0
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
# Parameters
{% set z = params.Z|default(10)|int %} ; z hop amount
{% set e = params.E|default(1) %}
{% if printer['pause_resume'].is_paused|int == 0 %}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro
# SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0 ; disable filament sensor
SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume
BASE_PAUSE ; pause print
{% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max
G91 ; relative positioning
G1 Z{z} F900 ; raise Z up by z hop amount
{% else %}
# { action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
{% endif %}
G1 E-{e} F2100
SAVE_GCODE_STATE NAME=PAUSEPARK
G90 ; absolute positioning
G1 X10 Y10 F6000 ; park toolhead at front center
#M104 S0 ; turn off hotend
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
{% endif %}
M106 S0
[gcode_macro RESUME]
rename_existing: BASE_RESUME
variable_zhop: 0
variable_etemp: 0
gcode:
# Parameters
{% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm)
{% if printer['pause_resume'].is_paused|int == 1 %}
#SET_FILAMENT_SENSOR SENSOR=fila ENABLE=1 ; enable filament sensor
#INITIAL_RGB ; reset LCD color
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
{% if etemp > 0 %}
M109 S{etemp|int} ; wait for hotend to heat back up
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
G91 ; relative extruder positioning
M83 ; restore position
{% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down
{% else %}
G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
{% endif %}
M400
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60
BASE_RESUME ; resume print
{% endif %}
M106 S255
####################################################################
# 共振补偿
#####################################################################
[idle_timeout]
timeout: 36000
[gcode_macro G40]
gcode:
ACCELEROMETER_QUERY
SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0
G28
M106 S255
SHAPER_CALIBRATE
SAVE_CONFIG
[gcode_macro SHAPER_CALIBRATE]
rename_existing: RESHAPER_CALIBRATE
gcode:
RESHAPER_CALIBRATE FREQ_START=5 FREQ_END=100
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # 共振补偿开始的位置
accel_per_hz: 300
[adxl345]
cs_pin: MKS_THR:gpio13
spi_software_sclk_pin: MKS_THR:gpio14
spi_software_mosi_pin: MKS_THR:gpio15
spi_software_miso_pin: MKS_THR:gpio12
[input_shaper]
#shaper_freq_x: 96.6
#shaper_type_x: mzv
#shaper_freq_y: 136.0
#shaper_type_y: 2hump_ei
[virtual_sdcard]
# path: ~/gcode_files
path: /home/mks/printer_data/gcodes
[pause_resume]
[exclude_object]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
G91
G1 Z10 F100
G90
G1 X10 F3000
M84
M106 S0
####################################################################
# 断料检测
#####################################################################
[filament_switch_sensor fila]
pause_on_runout: True#当设置为 "True "时,会在检测到耗尽后立即暂停打印机。
runout_gcode:
G91
G1 Z10
G90
G1 X10 Y10 F3000
M104 S220
M105
M109 S220
G91
G1 E30 F3000
G1 E-27 F9000
M106 S255
M104 S62
M105
M109 S62
G1 E-50 F300
M106 S0
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0
event_delay: 3.0
pause_delay: 0.5
switch_pin:PA1
[display_status]
####################################################################
# 温度波动阀值
#####################################################################
[verify_heater extruder]
max_error: 120
check_gain_time:120
hysteresis: 10
heating_gain: 2
[verify_heater heater_bed]
max_error: 120
check_gain_time:120
hysteresis: 10
heating_gain: 2
[probe]
pin:!MKS_THR:gpio21
x_offset: -22.2
y_offset: 0
speed:5 #自动调平速度
samples:3
samples_result:median
sample_retract_dist: 1.2 #调平两点之间的抬升高度
samples_tolerance: 0.05
samples_tolerance_retries: 3
[probe]
#z_offset: 0#2.0 #6.25
[gcode_macro G29]
gcode:
G28
G0 Z10 F1000
G1 X105 Y105 F1000
PROBE_CALIBRATE
#执行Z轴偏移
[gcode_macro G30]
gcode:
BED_MESH_CLEAR #清除调平数据
G28
BED_MESH_CALIBRATE #自动调平
BED_MESH_PROFILE SAVE="name" #保存调平数据
SAVE_CONFIG
BED_MESH_PROFILE LOAD="name" #加载调平数据
[gcode_macro G31]
gcode:
TESTZ Z=-1
#Z轴偏移-1
[gcode_macro G32]
gcode:
TESTZ Z=-0.5
#Z轴偏移-0.5
[gcode_macro G33]
gcode:
TESTZ Z=-0.1
#Z轴偏移-0.1
[gcode_macro G34]
gcode:
TESTZ Z=0.1
#Z轴偏移0.1
[gcode_macro G35]
gcode:
TESTZ Z=0.5
#Z轴偏移0.5
[gcode_macro G36]
gcode:
TESTZ Z=1
#Z轴偏移1
[gcode_macro G37]
gcode:
ACCEPT
#保存Z轴偏移数据
#####################################################################
# 自动退料
#####################################################################
[gcode_macro G50]
gcode:
M104 S220
M105
M109 S220
G91
G1 E30 F3000
G1 E-27 F9000
M106 S255
M104 S62
M105
M109 S62
G1 E-50 F300
M106 S0
M84
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0
[duplicate_pin_override]
pins:
PB5
[gcode_macro LOAD_FILAMENT]
#触摸屏端的自动进料
gcode:
M104 S220
M105
M109 S220
G91
G1 E100 F200
G90
[gcode_macro UNLOAD_FILAMENT]
#触摸屏端的自动退料
gcode:
M104 S220
M105
M109 S220
G91
G1 E30 F3000
G1 E-27 F9000
M106 S255
M104 S62
M105
M109 S62
G1 E-50 F300
M106 S0
M84
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0
[display]
lcd_type:uc1701
cs_pin: PE11
a0_pin: PE9
rst_pin: PE10
contrast: 63
encoder_pins:^PE13,^PE14
click_pin: ^!PE15
## Some micro-controller boards may require an spi bus to be specified:
#spi_bus: spi
## Alternatively, some micro-controller boards may work with software spi:
spi_software_miso_pin:PB5
spi_software_mosi_pin:PB5
spi_software_sclk_pin:PB3
[output_pin beeper]
pin: PC5
# Enable object exclusion
[exclude_object]
# Enable arcs support
[gcode_arcs]
resolution: 0.1
[neopixel mini12864]
pin: PE12
chain_count: 3
color_order: RGB
initial_RED: 1.0
initial_GREEN: 1.0
initial_BLUE: 0.0
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh name]
#*# version = 1
#*# points =
#*# 0.028750, -0.373750, -0.768750, -1.116250, -1.411250, -1.656250
#*# 0.188750, -0.218750, -0.605000, -0.937500, -1.252500, -1.532500
#*# 0.302500, -0.093750, -0.498750, -0.837500, -1.147500, -1.421250
#*# 0.388750, 0.021250, -0.350000, -0.720000, -1.013750, -1.288750
#*# 0.481250, 0.122500, -0.225000, -0.568750, -0.866250, -1.166250
#*# 0.566250, 0.232500, -0.113750, -0.435000, -0.682500, -0.968750
#*# tension = 0.2
#*# min_x = 10.000000000000004
#*# algo = lagrange
#*# y_count = 6
#*# mesh_y_pps = 2
#*# min_y = 20.0
#*# x_count = 6
#*# max_y = 220.0
#*# mesh_x_pps = 2
#*# max_x = 210.0
#*#
#*# [probe]
#*# z_offset = 2.325
#*#
#*# [input_shaper]
#*# shaper_type_x = mzv
#*# shaper_freq_x = 59.4
#*# shaper_type_y = zv
#*# shaper_freq_y = 66.6
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 72.465
#*# pid_ki = 2.166
#*# pid_kd = 605.989
#*#
#*# [bed_mesh default1]
#*# version = 1
#*# points =
#*# 0.026250, -0.316250, -0.670000, -0.970000, -1.182500, -1.410000
#*# 0.163750, -0.171250, -0.533750, -0.810000, -1.060000, -1.290000
#*# 0.288750, -0.061250, -0.425000, -0.686250, -0.933750, -1.176250
#*# 0.400000, 0.057500, -0.266250, -0.568750, -0.810000, -1.058750
#*# 0.505000, 0.181250, -0.126250, -0.412500, -0.661250, -0.861250
#*# 0.622500, 0.308750, 0.003750, -0.256250, -0.503750, -0.715000
#*# x_count = 6
#*# y_count = 6
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 10.000000000000004
#*# max_x = 210.0
#*# min_y = 20.0
#*# max_y = 220.0
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.028750, -0.373750, -0.768750, -1.116250, -1.411250, -1.656250
#*# 0.188750, -0.218750, -0.605000, -0.937500, -1.252500, -1.532500
#*# 0.302500, -0.093750, -0.498750, -0.837500, -1.147500, -1.421250
#*# 0.388750, 0.021250, -0.350000, -0.720000, -1.013750, -1.288750
#*# 0.481250, 0.122500, -0.225000, -0.568750, -0.866250, -1.166250
#*# 0.566250, 0.232500, -0.113750, -0.435000, -0.682500, -0.968750
#*# x_count = 6
#*# y_count = 6
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 10.000000000000004
#*# max_x = 210.0
#*# min_y = 20.0
#*# max_y = 220.0