Klipper-Macros 使用教程

Klipper-Macros 使用教程

项目介绍

Klipper-Macros 是一个为 Klipper 3D 打印机固件设计的宏集合。这个项目由 jschuh 创建,旨在提供一组一致且有用的宏,以便在多个 3D 打印机之间共享。这些宏不仅改进了基本功能(例如可选的构建表),还增强了 Klipper 与针对 Marlin 打印机的 G-code 的兼容性。此外,还有一些额外的功能,如在特定高度和层变化时调度命令,这些功能类似于切片器已经可以执行的操作,但更加简单,并且可以在打印过程中动态调度。

项目快速启动

安装步骤

  1. 克隆仓库

    git clone https://github.com/jschuh/klipper-macros.git
    
  2. 复制宏文件: 将所需的宏文件复制到你的 Klipper 配置目录中。

  3. 编辑 Klipper 配置文件: 在你的 Klipper 配置文件中包含这些宏文件,并根据需要进行配置。

  4. 重启 Klipper

    sudo service klipper restart
    

示例配置

在你的 printer.cfg 文件中添加以下内容:

[include macros/*.cfg]

应用案例和最佳实践

案例一:动态调度命令

假设你需要在打印的特定层暂停打印,以便进行手动干预。你可以使用以下宏:

[gcode_macro PAUSE_AT_LAYER]
gcode:
    SET_GCODE_VARIABLE MACRO=PAUSE_AT_LAYER VARIABLE=layer VALUE={layer_num}
    M117 Pausing at layer {layer_num}
    PAUSE

在切片软件中,设置在特定层执行 PAUSE_AT_LAYER 宏。

案例二:选择性构建表

假设你需要在不同的打印任务中使用不同的构建表。你可以定义多个构建表,并在启动打印时选择:

[gcode_macro SELECT_BUILD_SHEET]
gcode:
    SET_GCODE_VARIABLE MACRO=SELECT_BUILD_SHEET VARIABLE=sheet VALUE={params.SHEET}
    M117 Using sheet {params.SHEET}

在启动打印时,通过 G-code 命令选择构建表:

SELECT_BUILD_SHEET SHEET=A

典型生态项目

Klipper

Klipper 是一个基于微控制器的 3D 打印机固件,它通过将复杂的计算任务转移到主机电脑上来提高打印性能和可靠性。Klipper-Macros 是 Klipper 生态系统中的一个重要组成部分,提供了丰富的宏功能,增强了打印机的灵活性和可定制性。

Moonraker

Moonraker 是一个为 Klipper 设计的 API 服务器,它允许通过 HTTP 接口与 Klipper 进行交互。通过 Moonraker,你可以更方便地集成 Klipper-Macros 和其他 Klipper 功能到你的 Web 界面或自动化系统中。

Fluidd

Fluidd 是一个基于 Web 的 Klipper 控制界面,它提供了直观的用户界面来管理打印任务、监控打印状态和配置 Klipper。Fluidd 可以很好地与 Klipper-Macros 集成,提供更丰富的打印控制选项。

通过这些生态项目的配合,Klipper-Macros 可以发挥更大的作用,提供更全面的 3D 打印解决方案。

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

# This file works for GuguBOT with MKS Monster8 V2.0 Only # 本配置适用于使用MKS Monster8 V2.0版本主板的GuguBOT [include misc/timelapse.cfg] [include Klicky-Probe/klicky-probe.cfg] [include Klicky-Probe/z_calibration.cfg] [include misc/Gugu_Macros.cfg] [exclude_object] [mcu] ## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2E0027001251333233363732-if00 #-------------------------------------------------------------------- ##-------------------------------------------------------------------- [printer] kinematics: corexy max_velocity: 500 max_accel: 20000 max_z_velocity: 15 max_z_accel: 300 square_corner_velocity: 5.0 ############################################# # AB电机设置 ############################################# #-------------------------------------------------------------------- # 供CoreXY AB电机方向测试时使用,日常使用请勿开启 ##------------------------------------------------------------------- #[force_move] #enable_force_move: True #[respond] ##------------------------------------------------------------------- ## B电机(右后) 接主板Y驱动(Drive1:Y) [stepper_x] step_pin:PE5 dir_pin:PE4 enable_pin:!PC15 microsteps:16 rotation_distance: 40 full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper endstop_pin:PA14 position_min: 0 position_endstop:300 position_max:300 homing_speed:60 second_homing_speed:10 homing_retract_speed:10 homing_retract_dist:5 homing_positive_dir:true [tmc2209 stepper_x] uart_pin: PE3 interpolate: True run_current: 1.19 hold_current: 0.6 sense_resistor: 0.110 stealthchop_threshold: 0 ## A电机(左后) 接主板X驱动(Drive0:X) [stepper_y] step_pin:PC14 dir_pin:PC13 enable_pin:!PC15 microsteps: 16 rotation_distance: 40 full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper endstop_pin:PA15 position_min: 0 position_endstop: 320 position_max: 320 homing_speed:60 second_homing_speed:10 homing_retract_speed:10 homing_retract_dist:5 homing_positive_dir:true [tmc2209 stepper_y] uart_pin: PE6 interpolate: True run_current: 1.19 hold_current: 0.6 sense_resistor: 0.110 stealthchop_threshold: 0 ############################################# # Z电机设置 ############################################# ## Z0电机(左前) 接主板Z驱动(Drive2:Z1) [stepper_z] step_pin:PE1 dir_pin:!PE0 enable_pin: !PE2 microsteps: 16 rotation_distance: 2 #与丝杠导程数一致 full_steps_per_rotation: 200 endstop_pin:PB13 ## Z-position of nozzle (in mm) to z-endstop trigger point relative to print surface (Z0) ## (+) value = endstop above Z0, (-) value = endstop below ## Increasing position_endstop brings nozzle closer to the bed ## After you run Z_ENDSTOP_CALIBRATE, position_endstop will be stored at the very end of your config position_endstop:0 position_max: 300 position_min: -3 homing_speed: 6 second_homing_speed: 3.0 homing_retract_dist: 3.0 [tmc2209 stepper_z] uart_pin: PB7 interpolate: True run_current: 0.8 hold_current: 0.5 stealthchop_threshold: 0 ## Z1电机(后) 接主板E1驱动(Drive4:E1) [stepper_z1] step_pin:PD6 dir_pin:!PD5 enable_pin:!PD7 microsteps:16 rotation_distance: 2 #与丝杠导程数一致 full_steps_per_rotation: 200 [tmc2209 stepper_z1] uart_pin: PD4 interpolate: True run_current: 0.8 hold_current: 0.5 stealthchop_threshold: 0 ## Z2电机(右前) 接主板E2驱动(Drive5:E2) [stepper_z2] step_pin:PD2 dir_pin:!PD1 enable_pin:!PD3 microsteps: 16 rotation_distance: 2 #与丝杠导程数一致 full_steps_per_rotation: 200 [tmc2209 stepper_z2] uart_pin: PD0 interpolate: True run_current: 0.8 hold_current: 0.5 stealthchop_threshold: 0 ############################################# # 挤出机设置 ############################################# ## 挤出机电机 接主板E0驱动(Drive3:E0) [extruder] step_pin:PB5 dir_pin:PB4 enable_pin:!PB6 microsteps:16 rotation_distance: 22.75 #需要精确校准 gear_ratio: 50:10 full_steps_per_rotation: 200 #400 for 0.9 degree nozzle_diameter: 0.400 #与喷嘴保持一致 filament_diameter: 1.750 max_extrude_cross_section: 6.0 max_extrude_only_distance: 100.0 min_temp: 0 max_temp: 280 heater_pin: PB1 sensor_type: NTC 100K MGB18-104F39050L32 sensor_pin: PC1 max_power: 1.0 control : pid #校准在控制台输入PID_CALIBRATE HEATER=extruder TARGET=200 pid_kp : 18.293 pid_ki : 0.960 pid_kd : 87.119 pressure_advance: 0.035 pressure_advance_smooth_time: 0.040 [tmc2209 extruder] uart_pin: PB3 interpolate: True run_current: 0.71 hold_current: 0.4 sense_resistor: 0.110 stealthchop_threshold: 0 ##################################################################### # Probe ##################################################################### [probe] pin: PB12 x_offset: -1 y_offset: 25 z_offset: 9.90 speed: 5 samples:3 samples_result: median sample_retract_dist: 2.0 samples_tolerance: 0.01 samples_tolerance_retries: 3 [bed_mesh] speed: 100 horizontal_move_z: 16 mesh_min: 25, 25 mesh_max: 275, 275 probe_count: 5, 5 zero_reference_position: 150, 150 algorithm: bicubic mesh_pps: 2,2 fade_start: 3 fade_end: 10 fade_target: 0 [z_tilt] # 下面两项配置务必使用换行分割并缩进。分别对应z,z1,z2,注意!确保顺序正确,否则会越调越歪! # 注意确保每个points到丝杆的距离相同。确保给的XY探针能正常碰到床并触发! z_positions: # Z轴丝杆所在坐标 -52,-23 163,375 346,-23 points: # 探测点喷嘴的坐标,注意不是探针坐标 10,5 164,260 286,5 speed: 100 #xy移动速度 horizontal_move_z: 16 #z轴高度 retries: 3 #尝试次数,不同点之间的高度差大于下方的retry_tolerance值时候会进行重试。 retry_tolerance: 0.01 #允许不同点的高度差 ######################################## # 热床 ######################################## [heater_bed] heater_pin: PB10 sensor_type: NTC 100K MGB18-104F39050L32 sensor_pin: PC0 max_power: 1.0 control = pid #校准在控制台输入PID_CALIBRATE HEATER=bed TARGET=50 pid_kp = 72.923 pid_ki = 0.634 pid_kd = 2097.460 min_temp: 0 max_temp: 80 ######################################## # 风扇 ######################################## #散热块风扇,接FAN0接口 #[heater_fan my_nozzle_fan] [heater_fan NozzleFan] pin: PA2 max_power: 1.0 shutdown_speed: 0 heater: extruder heater_temp: 60.0 fan_speed: 1.0 #冷却风扇,接FAN1接口 [fan] pin: PA1 max_power: 1.0 #限制最高转速 shutdown_speed: 0 #背部驱动散热风扇,接FAN2接口 [controller_fan TMC_controller_fan] pin: PA0 max_power: 0.7 shutdown_speed: 0 kick_start_time: 0.5 idle_timeout: 600 idle_speed: 0.4 stepper: stepper_x, stepper_y, stepper_z, stepper_z1, stepper_z2, extruder [temperature_sensor KlipperBox] sensor_type: temperature_host min_temp: 5 max_temp: 100 ##################################################################### # LED ##################################################################### #补光LED,白光,接HE2接口 [output_pin Light] pin: PA3 pwm: False #氛围LED,红蓝光,接HE1接口 [output_pin AmbientLight] pin: PB0 pwm: False value: 1.0 shutdown_value: 1.0 #[output_pin caselight ](Use PA9) ## Chamber Lighting - In 5V-RGB Position #pin: PA9 #pwm: true #shutdown_value: 0 #value:100 #cycle_time: 0.01 ######################################## # EXP1 / EXP2 (display) pins ######################################## [board_pins] aliases: # EXP1 header EXP1_10=<5V>, EXP1_9=<GND>, EXP1_8=PE7, EXP1_7=PE15, EXP1_6=PD8, EXP1_5=PD9, # Slot in the socket on the other side EXP1_4=PD10, EXP1_3=PE11, EXP1_2=PE10, EXP1_1=PB2, # EXP2 header EXP2_10=<5V>, EXP2_9=<GND>, EXP2_8=<RST>, EXP2_7=PB11, EXP2_6=PA7, EXP2_5=PE8, # Slot in the socket on the other side EXP2_4=PA4, EXP2_3=PE9, EXP2_2=PA5, EXP2_1=PA6 # See the sample-lcd.cfg file for definitions of common LCD displays. # Some alternate glyphs for use with 128x64 LCDs. These are used by # adding them to your printer.cfg. # See docs/Config_Reference.md for a description of parameters. ###################################################################### # MKS Mini 12864v3.0 (with neopixel backlight leds) ###################################################################### [display] lcd_type: uc1701 cs_pin: EXP1_3 a0_pin: EXP1_4 rst_pin: EXP1_5 contrast: 63 encoder_pins: ^EXP2_5, ^EXP2_3 click_pin: ^!EXP1_2 ## 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: EXP2_1 spi_software_mosi_pin: EXP2_6 spi_software_sclk_pin: EXP2_2 [output_pin beeper] pin: EXP1_1 [neopixel fysetc_mini12864] pin: EXP1_6 chain_count: 3 color_order: RGB initial_RED: 0.0 initial_GREEN: 1.0 initial_BLUE: 0.76 ###################################################################### # ADXL345 共振测量 ###################################################################### [adxl345] cs_pin: PC9 spi_bus: spi3a [resonance_tester] accel_chip: adxl345 probe_points: 150, 150, 50 #测量时喷嘴所处的位置坐标 [input_shaper] shaper_freq_x: 85.2 shaper_freq_y: 65.6 shaper_type_x: ei shaper_type_y: ei ###################################################################### # gcode_macro ###################################################################### [gcode_macro CANCEL_PRINT] description: Cancel the actual running print rename_existing: CANCEL_PRINT_BASE gcode: TURN_OFF_HEATERS CANCEL_PRINT_BASE [virtual_sdcard] path: /home/pi/printer_data/gcodes #path: /home/klipper/printer_data/gcodes [pause_resume] [display_status] 这是目前我的klipper配置,下位机是mks monster8 v2 但是目前我下位机移动距离控制有点问题,全部归位都没有问题,但是我归位后移动距离,但是xy坐标值根本不变化,一直卡在归零后的坐标值。然后Z轴3个电机向下移动50mm,平台应该一起3个电机旋转下降,却只有一个电机向下移动,应该是z2动了其他俩个电机动都没动,z轴数值是有变化的
最新发布
07-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

滑隽蔚Maia

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值