Skip to content

Instantly share code, notes, and snippets.

@Nathan22211
Created July 6, 2024 21:30
Show Gist options
  • Select an option

  • Save Nathan22211/e56c31ca13c6a831eebf9c39579948a7 to your computer and use it in GitHub Desktop.

Select an option

Save Nathan22211/e56c31ca13c6a831eebf9c39579948a7 to your computer and use it in GitHub Desktop.

Revisions

  1. Nathan22211 created this gist Jul 6, 2024.
    499 changes: 499 additions & 0 deletions printer.cfg
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,499 @@
    #[include PIS.cfg]
    [include dynamic_PA.cfg]
    [include mainsail.cfg]

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

    [danger_options]
    allow_plugin_override: True

    [printer]
    square_corner_velocity: 5.0
    kinematics: limited_corexy
    max_velocity: 564
    max_z_velocity: 15
    max_accel: 6000
    max_x_accel: 6000
    max_y_accel: 5900
    max_z_accel: 300
    scale_xy_accel: True
    #-------------------------------------------------------------------- thermisters

    [thermistor NTC10K] #http://docs.ldomotors.com/en/guides/klipper-thermistor
    temperature1: 0.0
    resistance1: 32116.0
    temperature2: 40.0
    resistance2: 5309.0
    temperature3: 80.0
    resistance3: 1228.0

    #####################################################################
    # X/Y
    #####################################################################

    [stepper_x]
    ## Connected to X-MOT (B Motor)
    step_pin: PE11 # X轴电机脉冲引脚设置
    dir_pin: !PE10 # X轴电机方向引脚设置
    enable_pin: !PE9 # X轴电机使能引脚设置
    rotation_distance: 40 # 主动带轮周长mm(2GT-20T带轮40,2GT-16T带轮32)
    microsteps: 16 # 电机细分设置
    full_steps_per_rotation:200 # 电机单圈所需脉冲数(1.8度电机:200,0.9度电机:400)
    endstop_pin: ^PB14 # 限位开关PIN脚设置(X-)
    position_min: 0 # X轴最小行程--软件限位

    ##--------------------------------------------------------------------
    ## Uncomment for 350mm build
    position_endstop: 350 # X轴的机械复位点坐标(如果是350机型,需更改为350)
    position_max: 350 # X轴最大行程--软件限位(如果是350机型,需更改为350)
    ##--------------------------------------------------------------------

    homing_speed: 60 # 复位速度最大100
    homing_retract_dist: 0 # 第一次触发复位开关之后的后退距离
    homing_positive_dir: true # 复位方向(一般不需要改动)
    step_pulse_duration:0.000004

    ## Make sure to update below for your relevant driver (2208 or 2209)
    [tmc2209 stepper_x] # 步进电机-x tmc2209驱动
    uart_pin: PE7 # 通讯端口Pin脚定义
    interpolate: True # 是否开启256微步插值
    run_current: 1.0 # 电机运行电流值
    sense_resistor: 0.110 # 驱动采样电阻不要改


    ## Make sure to update below for your relevant driver (5160)
    #[tmc5160 stepper_x]
    #spi_bus: spi4
    #cs_pin: PE7
    #interpolate: True
    #diag1_pin: PB14
    #run_current: 0.800
    #hold_current: 0.500
    ##stealthchop_threshold: 0

    ######################## y轴设置 ########################

    [stepper_y]
    ## Connected to Y-MOT (A Motor)
    step_pin: PD8 # Y轴电机脉冲引脚
    dir_pin: PB12 # 方向设置
    enable_pin: !PD9 # 使能引脚
    rotation_distance: 40 # 主动轮周长mm (2GT-20T为 40mm 16T为 32mm)
    microsteps: 16 # 细分
    full_steps_per_rotation:200 # 单圈脉冲数-对于0.9度步进设置为400
    endstop_pin: ^PB13 # 限位开关接口
    position_min: 0 # 软限位最小行程
    step_pulse_duration:0.000004

    ##--------------------------------------------------------------------

    ## Uncomment for 350mm build
    position_endstop: 350 # y轴的机械复位点坐标(如果是350机型,需更改为350)
    position_max: 350 # y轴最大行程--软件限位(如果是350机型,需更改为350)

    ##--------------------------------------------------------------------

    homing_speed: 60 # 复位速度最大 100
    homing_retract_dist: 0 # 第一次触发复位开关之后的后退距离
    homing_positive_dir: true # 复位方向(一般不需要改动)

    ## Make sure to update below for your relevant driver (2208 or 2209)
    [tmc2209 stepper_y] # 步进电机-y tmc2209驱动
    uart_pin: PE15 # 驱动通信端口
    interpolate: True # 微步插值256
    run_current: 1.0 # 运行电流mA
    sense_resistor: 0.110 # 驱动采样电阻不要改

    ## Make sure to update below for your relevant driver (5160)
    #[tmc5160 stepper_y]
    #spi_bus: spi4
    #cs_pin: PE15
    ##diag1_pin: PB13
    #interpolate: True
    #run_current: 0.8
    #hold_current: 0.7
    ##stealthchop_threshold: 0

    #####################################################################
    # Z轴步进电机
    #####################################################################

    ## In Z-MOT Position
    ## Z0 步进电机 - 左前 on MOTOR2_1
    [stepper_z] # 步进电机-z
    step_pin: PE2 # Z3电机脉冲引脚
    dir_pin: PE4 # 方向设置
    enable_pin: !PE3 # 使能引脚
    rotation_distance: 4 # 主动轮周长mm (2GT-20T为 40mm 16T为 32mm) # 减速比
    microsteps: 16 # 细分
    endstop_pin: probe:z_virtual_endstop # 限位开关接口
    #position_endstop: 0
    position_max: 290
    position_min: -5
    homing_speed: 50 # 复位速度-最大 20
    second_homing_speed: 10 # 二次复位速度-最大 10
    homing_retract_dist: 3 # 后撤距离

    ## Make sure to update below for your relevant driver (2208 or 2209)
    [tmc2209 stepper_z] # 步进电机-z tmc2209驱动
    uart_pin: PC14 # 驱动通信端口
    uart_address: 0
    interpolate: True # 微步插值256
    run_current: 1.0 # 运行电流mA
    hold_current: 1.0 # 保持电流mA
    sense_resistor: 0.110 # 驱动采样电阻不要改
    stealthchop_threshold: 0 # 静音阀值

    ## In E2-MOT Position
    ## Z2 Stepper - Rear Right
    [stepper_z1] # 步进电机-z2
    step_pin: PE6 # Z电机脉冲引脚
    dir_pin: PC13 # 方向设置
    enable_pin: !PE5 # 使能引脚
    rotation_distance: 4 # 主动轮周长mm (2GT-20T为 40mm 16T为 32mm)
    microsteps: 16 # 细分

    ## Make sure to update below for your relevant driver (2208 or 2209)
    [tmc2209 stepper_z1] # 步进电机-z2 tmc2209驱动
    uart_pin: PA15 # 驱动通信端口
    interpolate: True # 微步插值256
    run_current: 1.0 # 运行电流mA
    hold_current: 1.0 # 保持电流mA
    sense_resistor: 0.110 # 驱动采样电阻不要改
    stealthchop_threshold: 0 # 静音阀值

    ## In E3-MOT Position
    ## Z3 步进电机 - 右前 on MOTOR5
    [stepper_z2]
    step_pin: PD12 # Z2电机脉冲引脚
    dir_pin: PC4 # 方向设置
    enable_pin: !PE8 # 步进电机-z3 # 使能引脚
    rotation_distance: 4 # 主动轮周长mm (2GT-20T为 40mm 16T为 32mm)
    microsteps: 16 # 细分

    [tmc2209 stepper_z2] # 步进电机-z3 tmc2209驱动
    uart_pin: PC15 # 驱动通信端口
    interpolate: True # 微步插值256
    run_current: 1.0 # 运行电流mA
    hold_current: 1.0 # 保持电流mA
    sense_resistor: 0.110 # 驱动采样电阻不要改
    stealthchop_threshold: 0 # 静音阀值


    #####################################################################
    # 挤出机配置
    #####################################################################

    ## In E0-MOT Position
    [extruder] # 挤出机
    step_pin: PD5 # E0电机脉冲引脚
    dir_pin: !PD6 # 方向引脚设置
    enable_pin: !PD4 # 使能引脚设置

    ## Update value below when you perform extruder calibration
    ## If you ask for 100mm of filament, but in reality it is 98mm:
    ## rotation_distance = <previous_rotation_distance> * <actual_extrude_distance> / 100
    ## 22.6789511 is a good starting point
    rotation_distance: 21.525 # 步进值-Bondtech 5mm 驱动齿轮
    ## Update Gear Ratio depending on your Extruder Type
    ## Use 50:17 for Afterburner/Clockwork (BMG Gear Ratio)
    ## Use 80:20 for M4, M3.1
    #gear_ratio: 50:10
    gear_ratio: 50:10 # BMG 传动比
    microsteps: 16 # 细分
    full_steps_per_rotation: 200 # 单圈脉冲数 (200 为 1.8 度, 400 为 0.9 度)
    nozzle_diameter: 0.600 # 喷嘴直径
    filament_diameter: 1.75 # 耗材直径
    ## In E0 OUT Position
    heater_pin: PB15 # 加热棒引脚
    ## Validate the following thermistor type to make sure it is correct
    sensor_type: PT1000 #传感器型号 (NTC 100K beta 3950,ATC Semitec 104GT-2)
    sensor_pin: PC0 # 传感器接口
    min_temp: 10 # 最小温度
    max_temp: 315 # 最大温度
    max_power: 1.0 # 最大功率
    min_extrude_temp: 170 # 最小挤出温度
    #control: mpc
    heater_power: 115
    cooling_fan: fan
    ambient_temp_sensor: heater_generic chamber_heater
    ## Try to keep pressure_advance below 1.0
    pressure_advance: 0.05 # 推进压力-尽量将压力保持在1.0以下
    ## Default is 0.040, leave stock
    pressure_advance_smooth_time: 0.040 # 平稳推进时间-默认值为0.040
    max_extrude_cross_section: 5

    ## In E0-MOT Position
    ## Make sure to update below for your relevant driver (2208 or 2209)
    [tmc2209 extruder] # 挤出机 tmc2209驱动
    uart_pin: PD7 # 驱动通信端口
    interpolate: true # 微步插值256
    run_current: 0.65 # 运行电流mA
    sense_resistor: 0.110 # 驱动采样电阻不要改

    [verify_heater extruder]
    hysteresis: 15
    heating_gain: 0.5
    check_gain_time: 120

    #####################################################################
    # 热床配置
    #####################################################################

    [heater_bed]
    ## SSR Pin - In BED OUT position
    heater_pin: PB4
    sensor_type: Generic 3950
    #sensor_pin: PC3
    sensor_pin: PB0
    ## Adjust Max Power so your heater doesn't warp your bed
    max_power: 0.8
    min_temp: 5
    max_temp: 170
    #control: pid
    #pid_kp: 58.437
    #pid_ki: 2.347
    #pid_kd: 363.769

    #####################################################################
    # Probe
    #####################################################################

    [probe]
    pin: ^PA3
    x_offset: 0
    y_offset: 25.0
    #z_offset: 0
    speed: 50.0
    samples: 3
    samples_result: median
    sample_retract_dist: 3.0
    samples_tolerance: 0.06
    samples_tolerance_retries: 3
    activate_gcode:
    {% set PROBE_TEMP = 150 %}
    {% set MAX_TEMP = PROBE_TEMP + 5 %}
    {% set ACTUAL_TEMP = printer.extruder.temperature %}
    {% set TARGET_TEMP = printer.extruder.target %}

    {% if TARGET_TEMP > PROBE_TEMP %}
    { action_respond_info('Extruder temperature target of %.1fC is too high, lowering to %.1fC' % (TARGET_TEMP, PROBE_TEMP)) }
    M109 S{ PROBE_TEMP }
    {% else %}
    # Temperature target is already low enough, but nozzle may still be too hot.
    {% if ACTUAL_TEMP > MAX_TEMP %}
    { action_respond_info('Extruder temperature %.1fC is still too high, waiting until below %.1fC' % (ACTUAL_TEMP, MAX_TEMP)) }
    TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={ MAX_TEMP }
    {% endif %}
    {% endif %}

    [safe_z_home]
    home_xy_position: 175, 175
    #####################################################################
    # 风扇配置
    #####################################################################

    [heater_fan hotend_fan]
    ## Hotend Fan - FAN0 Connector
    pin: PA13
    max_power: 1.0
    kick_start_time: 0.5
    heater: extruder
    heater_temp: 50.0
    fan_speed: 1.0

    [fan]
    ## Print Cooling Fan - FAN1 Connector
    pin: PA14
    max_power: 0.4
    kick_start_time: 0.5
    off_below: 0.10

    # [heater_fan controller_fan] # 电器仓风扇
    # ## Controller fan - FAN2 Connector
    # pin: PC8 # 信号接口
    # kick_start_time: 0.5 # 启动时间(勿动)
    # heater: heater_bed # 关联的设备:热床
    # heater_temp: 45.0 # 热床达到多少度启动风扇

    # [heater_fan exhaust_fan] # 打印仓排风扇
    # ## Exhaust fan - In E2 OUT Positon
    # pin: PB3 # 信号接口
    # max_power: 1.0 # 最大转速
    # shutdown_speed: 0.0 # 关闭速度(勿动)
    # kick_start_time: 5.0 # 开启时间(勿动)
    # heater: heater_bed # 关联的设备:热床
    # heater_temp: 60 # 热床达到多少度启动风扇
    # fan_speed: 1.0 # 风扇转速

    #####################################################################
    # LED控制
    #####################################################################

    [neopixel my_neopixel] # 输入英文的中括号启用这个定义
    pin:PD3 # 主板引脚定义
    chain_count:26 # 灯珠数量
    color_order: GRBW # 颜色顺序
    initial_RED: 0.2 # 红色 灯开机默认值最大是1
    initial_GREEN: 0.2 # 绿色 灯开机默认值最大是1
    initial_BLUE: 0.2 # 蓝色 灯开机默认值最大是1

    #####################################################################
    # 闲置关闭热床
    #####################################################################

    [idle_timeout]
    timeout: 1800

    #####################################################################
    # 控制归位和龙门架调平
    #####################################################################

    [bed_mesh]
    speed: 100
    horizontal_move_z: 10
    mesh_min: 40, 40
    mesh_max: 310,310
    fade_start: 0.6
    fade_end: 10.0
    probe_count: 7,7
    algorithm: bicubic
    adaptive_margin: 5

    [z_tilt]
    z_positions:
    -50, 18
    150, 348
    350, 18

    points:
    30, 5
    175, 295
    320, 5

    speed: 100
    horizontal_move_z: 10
    retries: 10
    retry_tolerance: 0.01

    #--------------------------------------------------------------------
    ## Virtual SD Card
    [virtual_sdcard]
    path: ~/printer_data/gcodes

    # Pause/Resume Functionality
    [pause_resume]

    #####################################################################
    # gcode
    #####################################################################

    [gcode_macro G32]
    gcode:
    BED_MESH_CLEAR
    G28
    Z_TILT_ADJUST
    G28
    G0 X175 Y175 Z30 F3600

    [display_status]

    [save_variables]
    filename: ~/printer_data/config/variables.cfg

    [gcode_macro PRINT_START]
    gcode:
    G28
    HEAT_BED_AND_WAIT
    G28 Z
    BED_MESH_CALIBRATE ADAPTIVE=1
    BED_MESH_PROFILE LOAD=default
    G92 E0
    G90
    HEAT_EXTRUDER_AND_WAIT
    SET_PAS Innerwall={printer.extruder.filament.pa_inner_wall} Outerwall={printer.extruder.filament.pa_outer_wall} Sparseinfill={printer.extruder.filament.pa_infill}
    #SKEW_PROFILE LOAD=skew


    [gcode_macro PRINT_END]
    # Use PRINT_END for the slicer ending script - please customise for your slicer of choice
    gcode:
    M400 # 等待缓冲区清除
    G92 E0 # 将挤出机归零
    G1 E-1.0 F3600 # 缩回耗材丝
    G91 # 相对定位
    G0 Z1.00 X20.0 Y20.0 F20000 # 移动喷嘴以移除架线
    TURN_OFF_HEATERS # 关闭热端
    M107 # 关闭风扇 # 将喷嘴向上移动2毫米
    G90 # 绝对定位
    G0 X350 Y350 F3600
    #SET_SKEW CLEAR=1 # 将喷嘴停在后部 # 卸载网床
    [gcode_macro CANCEL_PRINT]
    rename_existing: BASE_CANCEL_PRINT
    gcode:
    TURN_OFF_HEATERS
    CLEAR_PAUSE
    SDCARD_RESET_FILE
    BASE_CANCEL_PRINT
    G90
    G0 X350 Y350 F3600
    SET_SKEW CLEAR=1


    # Enable object exclusion
    [exclude_object]

    # Enable arcs support
    [gcode_arcs]
    resolution: 0.1

    [input_shaper]
    #enabled_extruders: extruder
    shaper_freq_x: 48.6
    shaper_type_x: mzv
    shaper_freq_y: 49.4
    shaper_type_y: 2hump_ei

    ##################################################################################
    #extras
    ##################################################################################

    #--------------------------------------------------------------------------------- filament management
    [filaments]
    on_set_filament_gcode:
    M117 add
    on_clear_filament_gcode:
    M117 clear

    #--------------------------------------------------------------------------------- thermal adjust
    [z_thermal_adjust]
    temp_coeff: 0.005
    smooth_time: 1
    sensor_type: NTC10K
    sensor_pin: PC2
    min_temp: 10
    max_temp: 67
    gcode_id: thermal_adjust

    #--------------------------------------------------------------------------------- auxiliry cooling

    #[fan_generic auxiliry]
    #pin: PA14
    #max_power: 1.0
    #kick_start_time: 0.2

    [idle_timeout]
    #gcode:
    timeout: 9999999999

    [skew_correction]

    ## Thermistor Types
    ## "EPCOS 100K B57560G104F"
    ## "ATC Semitec 104GT-2"
    ## "NTC 100K beta 3950"
    ## "Honeywell 100K 135-104LAG-J01"
    ## "NTC 100K MGB18-104F39050L32" (Keenovo Heater Pad)
    ## "AD595"
    ## "PT100 INA826"