VORON Trident Reference Configuration
####################################################################################
#                         3D MELLOW /FLY-Super8-Pro                                #
####################################################################################
## FLY-Super8-Pro Documentation URL: http://mellow.klipper.cn/#/board/fly_super8_pro/README
## FLY-Super8-Pro Schematic URL: https://github.com/Mellow-3D/Fly-Super8Pro
## FLY Official Taobao Store: https://shop126791347.taobao.com/shop/view_shop.htm?spm=a230r.1.14.4.1a4840a8hyvpPJ&user_number_id=2464680006
## For after-sales, please contact Taobao customer service
## FLY After-sales Technical Support Group: 621032883
## FLY-RRF Firmware Discussion Group: 786561979
#####################################################################
# 	                          Notes                                  #
#####################################################################
##***Items that need to be changed/checked:***
## MCU path                             [mcu] 
## Printer movement range                 xyz position      
## Thermistor type                        [extruder] and [heater_bed]
## Z-axis endstop position                [homing_override] 
## Z-axis endstop offset                  [stepper_z] 
## PID calibration                        [extruder] and [heater_bed] 
## Fine-tune extruder motor step value    [extruder] 
#####################################################################
# 	                          File Inclusion                          #
#####################################################################
#[include fluidd.cfg]          # FLUIDD configuration file.
#[include mainsail.cfg]        # MAINSDIL configuration file.
# Please determine which file to use
#####################################################################
# 	                          Board Configuration                     #
#####################################################################
[mcu]                           # FLY board ID
serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_XXXXXXXXXXXXXXXXXXXXX
### Query usb firmware ID using: ls -l /dev/serial/by-id/
### Replace /dev/serial/by-id/usb-Klipper_stm32f407xx_XXXXXXXXXXXXXXXXXXXXX with the ID found
#canbus_uuid: e51d5c71a901
### Query can firmware ID using: ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
### For can, replace serial with canbus_uuid: and append the ID 
#####################################################################
#                            Printer Model and Acceleration          #
#####################################################################
[printer]                       # Printer settings
kinematics: corexy              # Kinematic structure: Cartesian and corexy etc. Cartesian: cartesian
max_velocity: 300               # Maximum printer speed   
max_accel: 3000                 # Maximum acceleration (maximum 3000)
max_z_velocity: 15              # Maximum Z-axis speed
max_z_accel: 100                # Maximum Z-axis acceleration
square_corner_velocity: 5.0     # Square corner velocity, lower value can help reduce inertia from heavy platforms
#####################################################################
#                             Temperature Monitoring                 #
#####################################################################
[temperature_sensor Fly-Super8]     # FLY board temperature (can be renamed)
sensor_type: temperature_mcu     # Associated mcu (default)
#--------------------------------------------------------------------
[temperature_sensor FLY-π]        # Host computer temperature
sensor_type: temperature_host     # Associated host computer
#--------------------------------------------------------------------
# [temperature_sensor Box]          # Enclosure temperature (requires additional temperature sensor, refer to configuration)
# sensor_type: ATC Semitec 104GT-2  # Sensor model
# sensor_pin: PA4                   # Signal pin
#####################################################################
# 	                         Bed Mesh Calibration
#####################################################################
[bed_mesh]
speed: 50                    # Calibration speed
horizontal_move_z: 5         # Z lift height before probing next point
mesh_min: 30,30              # Minimum calibration point coordinates x, y
mesh_max: 270, 270           # Maximum calibration point coordinates x, y
probe_count: 4,4             # Number of sampling points (4x4 = 16 points)
mesh_pps: 2,2                # Additional sampling points
algorithm: bicubic           # Algorithm model
bicubic_tension: 0.2         # Do not adjust interpolation value
#####################################################################
#             X/Y Stepper Motor Settings                           # 
#####################################################################
#   B Motor ---- Motor A 
#   |                  |
#   |------Extruder------|
#   |                  |
#   |                  |
#          Front View   
#####################################################################
#                  X-axis Stepper Motor on Driver0 (B Motor)         #
#####################################################################
[stepper_x]
step_pin: PE2                       # X-axis motor step pin
dir_pin: PC5                        # X-axis motor direction pin, use ! to reverse direction
enable_pin: !PF11                   # X-axis motor enable pin, must have ! or motor won't work
rotation_distance: 40               # Belt pulley circumference mm (2GT-20T pulley 40, 2GT-16T pulley 32)
microsteps: 16                      # Motor microstepping setting, higher = better quality but heavier load
full_steps_per_rotation: 200        # Steps per revolution (1.8 degree motor: 200, 0.9 degree motor: 400)
endstop_pin: !PG12                  # Endstop pin, normally closed recommended with ! to invert state, located at io-3
###Normally closed is triggered state, add ! to invert in case of wire break
position_min: 0                     # Minimum software limit
position_endstop: 300               # Maximum software limit (250mm-300mm-350mm)
position_max: 300                   # Maximum mechanical limit (250mm-300mm-350mm)
homing_speed: 50                    # Homing speed, maximum 100, recommended not too fast
homing_retract_dist: 5              # Retract distance after first endstop trigger
step_pulse_duration: 0.000004
#--------------------------------------------------------------------
##  Please ensure correct driver model (2208 or 2209)
[tmc2209 stepper_x]                 # X-axis driver config -TMC2209
uart_pin: PC4                       # UART pin definition
interpolate: False                  # Enable 256 microstep interpolation (True/False)
run_current: 0.8                    # Running current
sense_resistor: 0.110               # Driver sense resistor, do not change
stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth mode)
#--------------------------------------------------------------------
#[tmc5160 stepper_x]                 # Extruder driver config - TMC5160
#cs_pin: PC4                         # SPI chip select pin
# spi_software_mosi_pin: PB5
# spi_software_miso_pin: PB4
# spi_software_sclk_pin: PB3
## spi_bus: spi1a                     # SPI bus selection, software SPI recommended
## spi_speed: 100000               # SPI communication speed
#run_current: 1.0                    # Motor running current
#interpolate: False                  # Enable 256 microstep interpolation (True/False)
#sense_resistor: 0.075               # Driver sense resistor (change to 0.033 for 5160 Pro)
#stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth mode)
#####################################################################
#                  Y-axis Stepper Motor on Driver1 (A Motor)         #
#####################################################################
[stepper_y]
step_pin: PE3                       # Y-axis motor step pin
dir_pin: PF13                      # Y-axis motor direction pin, use ! to reverse
enable_pin: !PF14                   # Y-axis motor enable pin, must have ! or won't work
rotation_distance: 40               # Belt pulley circumference mm (2GT-20T pulley 40, 2GT-16T pulley 32)
microsteps: 16                      # Microstepping setting, higher = better quality
full_steps_per_rotation: 200        # Steps per revolution (1.8° motor: 200, 0.9° motor: 400)
endstop_pin: !PG11                  # Endstop pin, normally closed with ! inversion, located at io-0
###Normally closed is triggered state, add ! to invert in case of wire break
position_min: 0                     # Minimum software limit
position_endstop: 300               # Maximum software limit (250mm-300mm-350mm)
position_max: 300                   # Maximum mechanical limit (250mm-300mm-350mm)
homing_speed: 50                    # Homing speed, max 100, recommended not too fast
homing_retract_dist: 5              # Retract distance after first trigger
step_pulse_duration: 0.000004
#--------------------------------------------------------------------
##  Please ensure correct driver model (2208 or 2209)
[tmc2209 stepper_y]                 # Y-axis driver config -TMC2209
uart_pin: PF12                      # UART pin definition
interpolate: False                  # Enable 256 microstep interpolation (True/False)
run_current: 0.8                    # Running current
sense_resistor: 0.110               # Sense resistor, do not change
stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
#[tmc5160 stepper_y]                 # Extruder driver config - TMC5160
#cs_pin: PF12                        # SPI chip select pin
# spi_software_mosi_pin: PB5
# spi_software_miso_pin: PB4
# spi_software_sclk_pin: PB3
## spi_bus: spi1a                     # SPI bus selection, software SPI recommended
# spi_speed: 100000                   # SPI communication speed
#run_current: 1.0                    # Motor running current
#interpolate: False                  # Enable 256 microstep interpolation (True/False)
#sense_resistor: 0.075               # Sense resistor (change to 0.033 for 5160 Pro)
#stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#####################################################################
#                     Z-axis Stepper Motor Settings                 #
#####################################################################
#   |----- Z1 -----|
#   |              |
#   |              |
#   |              |
#   Z0----Display----Z2
#####################################################################
#                           Z-axis Stepper Motor                    #
#####################################################################
##	Z-axis stepper motor - Front left on Driver3
[stepper_z]
step_pin: PE14                 # Z-axis motor step pin
dir_pin:  !PE8                 # Z-axis motor direction pin, use ! to reverse
enable_pin: !PE9               # Z-axis motor enable pin, must have ! or won't work
### T8x4 lead screw. One revolution moves bed 4mm 
## Modify according to your actual screw parameters
rotation_distance: 8          # Lead screw pitch is 8, modify in 3 locations total
full_steps_per_rotation: 200  # Steps per revolution (1.8° motor: 200, 0.9° motor: 400)
microsteps: 16                # Microstepping setting, higher = better quality
endstop_pin: !PG10            # Endstop pin, normally closed with ! inversion, located at io-1
## position_endstop is the position of Z endstop trigger point relative to print surface (Z0) in mm
position_endstop:  -0.5
## Positive = above bed, negative = below bed
## Increasing position_endstop brings nozzle closer to bed
## After Z_ENDSTOP_CALIBRATE, position_endstop will be stored at end of CFG
position_min: -15             # (set to ~-5 for nozzle cleaning)
position_max: 300             # Maximum mechanical limit (250mm-300mm-350mm)
homing_speed: 5               # Homing speed - max 20
second_homing_speed: 3        # Secondary homing speed - max 10
homing_retract_dist: 0        # Retract distance
step_pulse_duration: 0.000004
#--------------------------------------------------------------------
[tmc2209 stepper_z]
uart_pin: PE7                 # Driver UART port
interpolate: false            # 256 microstep interpolation
run_current: 0.8              # Running current mA
sense_resistor: 0.110         # Sense resistor, do not change
stealthchop_threshold: 500    # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
#[tmc5160 stepper_z]                 # Extruder driver config - TMC5160
#cs_pin: PE7                         # SPI chip select pin
# spi_software_mosi_pin: PB5
# spi_software_miso_pin: PB4
# spi_software_sclk_pin: PB3
## spi_bus: spi1a                     # SPI bus selection, software SPI recommended
# spi_speed: 100000                   # SPI communication speed
#run_current: 1.0                    # Motor running current
#interpolate: False                  # Enable 256 microstep interpolation (True/False)
#sense_resistor: 0.075               # Sense resistor (change to 0.033 for 5160 Pro)
#stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
##	Z1 stepper motor - Rear on Driver4
[stepper_z1]
step_pin: PE15                # Z1-axis motor step pin
dir_pin:  !PE11               # Z1-axis motor direction pin, use ! to reverse
enable_pin: !PF2              # Z1-axis motor enable pin, must have ! or won't work
### T8x4 lead screw. One revolution moves bed 4mm 
## Modify according to your actual screw parameters
rotation_distance: 8          # Lead screw pitch is 8
full_steps_per_rotation: 200  # Steps per revolution (1.8° motor: 200, 0.9° motor: 400)
microsteps: 16                # Microstepping setting, higher = better quality
step_pulse_duration: 0.000004
#--------------------------------------------------------------------
[tmc2209 stepper_z1]
uart_pin: PE10                # Driver UART port
interpolate: false            # 256 microstep interpolation
run_current: 0.8              # Running current mA
sense_resistor: 0.110         # Sense resistor, do not change
stealthchop_threshold: 500    # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
#[tmc5160 stepper_z1]                # Extruder driver config - TMC5160
#cs_pin: PE10                        # SPI chip select pin
# spi_software_mosi_pin: PB5
# spi_software_miso_pin: PB4
# spi_software_sclk_pin: PB3
## spi_bus: spi1a                     # SPI bus selection, software SPI recommended
# spi_speed: 100000                   # SPI communication speed
#run_current: 1.0                    # Motor running current
#interpolate: False                  # Enable 256 microstep interpolation (True/False)
#sense_resistor: 0.075               # Sense resistor (change to 0.033 for 5160 Pro)
#stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
##	Z2 stepper motor - Front right on Driver5
[stepper_z2]
step_pin: PE1                 # Z2-axis motor step pin
dir_pin: !PF0                 # Z2-axis motor direction pin, use ! to reverse
enable_pin: !PC15             # Z2-axis motor enable pin, must have ! or won't work
### T8x4 lead screw. One revolution moves bed 4mm 
## Modify according to your actual screw parameters
rotation_distance: 8          # Lead screw pitch is 8
full_steps_per_rotation: 200  # Steps per revolution (1.8° motor: 200, 0.9° motor: 400)
microsteps: 16                # Microstepping setting, higher = better quality
step_pulse_duration: 0.000004
#--------------------------------------------------------------------
[tmc2209 stepper_z2]
uart_pin: PF1                # Driver UART port
interpolate: false            # 256 microstep interpolation
run_current: 0.8              # Running current mA
sense_resistor: 0.110         # Sense resistor, do not change
stealthchop_threshold: 500    # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
#[tmc5160 stepper_z2]                # Extruder driver config - TMC5160
#cs_pin: PF1                         # SPI chip select pin
# spi_software_mosi_pin: PB5
# spi_software_miso_pin: PB4
# spi_software_sclk_pin: PB3
## spi_bus: spi1a                     # SPI bus selection, software SPI recommended
# spi_speed: 100000                   # SPI communication speed
#run_current: 1.0                    # Motor running current
#interpolate: False                  # Enable 256 microstep interpolation (True/False)
#sense_resistor: 0.075               # Sense resistor (change to 0.033 for 5160 Pro)
#stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
#####################################################################
#                     E0 Extruder Settings                          # 
#####################################################################
#Driver2
[extruder]                          # Extruder
step_pin: PE4                       # Extruder motor step pin
dir_pin: !PG0                       # Extruder motor direction pin
enable_pin: !PG1                    # Extruder motor enable pin
## Update this value after extruder calibration
## If you request 100mm feed but actually get 102:
## rotation_distance = <old rotation_distance> * <actual extrusion> / <requested extrusion>
## Calibration step value: 22.44=old value 22*actual 102/target 100
rotation_distance: 22.44            # Step value
gear_ratio: 50:17                   # Gear ratio (Galileo ratio 7.5:1 commented out; BMG 50:17, output first, input second)
microsteps: 16                      # Microstepping setting, higher = better quality
full_steps_per_rotation: 200        # Steps per revolution (200 for 1.8°, 400 for 0.9°)
nozzle_diameter: 0.400              # Nozzle diameter
filament_diameter: 1.75             # Filament diameter
heater_pin: PB0                     # Heater pin
sensor_type: ATC Semitec 104GT-2    # Sensor model (Generic 3950, ATC Semitec 104GT-2, PT1000)
sensor_pin: PF4                     # Sensor pin connected to ADC_0   
min_temp: 10                        # Minimum temperature (exceeding triggers emergency stop)
max_temp: 350                       # Maximum temperature (exceeding triggers emergency stop)
max_power: 1.0                      # Maximum power
min_extrude_temp: 170               # Minimum extrusion temperature (must reach this to extrude)
pressure_advance: 0.05              # Pressure advance - keep under 1.0
#Pressure advance adjustment: https://www.klipper3d.org/zh/Pressure_Advance.html
pressure_advance_smooth_time: 0.040 # Pressure smoothing time - default 0.040
#max_extrude_only_distance: 200.0   # Comment this if you get extrusion flow error, but better to re-slice
max_extrude_only_distance: 800
max_extrude_cross_section:800
#Nozzle PID calibration command: "PID_CALIBRATE HEATER=extruder TARGET=245"
control:watermark
step_pulse_duration: 0.000004
#--------------------------------------------------------------------
[tmc2209 extruder]                  # Extruder driver config - TMC2209
uart_pin: PF15                      # UART pin definition
interpolate: False                  # Enable 256 microstep interpolation (True/False)
run_current: 0.5                    # Motor running current
sense_resistor: 0.110               # Sense resistor, do not change
stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#--------------------------------------------------------------------
#[tmc5160 extruder]                  # Extruder driver config - TMC5160
#cs_pin: PF15                        # SPI chip select pin
# spi_software_mosi_pin: PB5
# spi_software_miso_pin: PB4
# spi_software_sclk_pin: PB3
## spi_bus: spi1a                     # SPI bus selection, software SPI recommended
# spi_speed: 100000                   # SPI communication speed
#run_current: 1.0                    # Motor running current
#interpolate: False                  # Enable 256 microstep interpolation (True/False)
#sense_resistor: 0.075               # Sense resistor (change to 0.033 for 5160 Pro)
#stealthchop_threshold: 500          # StealthChop threshold (set to 0 for no stealth)
#####################################################################
#                            Heater Bed Configuration               #
#####################################################################
[heater_bed]
heater_pin: PE5              # Heater bed pin
sensor_type: Generic 3950    # Heater bed sensor type
sensor_pin:  PC1             # Heater bed sensor pin
max_power: 0.5               # Heater bed power
min_temp: 0                  # Minimum temperature (exceeding triggers emergency stop)
max_temp: 120                # Maximum temperature (exceeding triggers emergency stop)
#Heater bed PID calibration command: "PID_CALIBRATE HEATER=heater_bed TARGET=100"
control:watermark
#####################################################################
#                            Fan Configuration                      #
#####################################################################
[fan]                        # Part cooling fan
pin: PA0                     # Signal pin
kick_start_time: 0.5         # Startup time (do not change)
off_below: 0.10              # Do not change
#--------------------------------------------------------------------
[heater_fan hotend_fan]      # Hotend cooling fan
pin: PA1                     # Signal pin
max_power: 1.0               # Maximum speed
kick_start_time: 0.5         # Startup time (do not change)
heater: extruder             # Associated device: extruder
heater_temp: 50              # Fan starts when extruder reaches this temperature
fan_speed: 1.0               # Fan speed
#--------------------------------------------------------------------
[heater_fan controller_fan]  # Electronics cooling fan
pin: PA2                     # Signal pin
max_power: 1.0               # Maximum speed
kick_start_time: 0.5         # Startup time (do not change)
heater: heater_bed           # Associated device: heater bed
heater_temp: 50              # Fan starts when heater bed reaches this temperature
fan_speed: 1.0               # Fan speed
#--------------------------------------------------------------------
[heater_fan exhaust_fan]    # Exhaust fan
pin: PA3                     # Signal pin
max_power: 1.0               # Maximum speed
kick_start_time: 0.5         # Startup time (do not change)
heater: heater_bed           # Associated device: heater bed
heater_temp: 70              # Fan starts when heater bed reaches this temperature
fan_speed: 1.0               # Fan speed
#####################################################################
#                           Probe Sensor                            #
#####################################################################
#Default PL08N inductive probe doesn't go below nozzle height, only for leveling. If your PL08N is NO (normally open), add ! to pin
[probe]
pin: ^PF3                   # Endstop pin, normally closed recommended with ! inversion, located at io-2
x_offset: 0                  # X-axis - probe offset relative to nozzle
y_offset: 25.0               # Y-axis - probe offset relative to nozzle
z_offset: 0                  # Z-axis - probe offset relative to nozzle
speed: 10.0                  # Leveling speed
samples: 3                   # Number of samples
samples_result: median       # Result method (default median)
sample_retract_dist: 4.0     # Retract distance during sampling
samples_tolerance: 0.006     # Sample tolerance (too small may increase sampling attempts)
samples_tolerance_retries: 3 # Retries when exceeding tolerance
#####################################################################
#                               Homing                              #
#####################################################################
# [safe_z_home]                # Z-axis endstop position
# home_xy_position:206,300     # Z-axis endstop position definition (important!! adjust accordingly)
# speed:100                    # Homing speed
# z_hop:10                     # Z lift before homing
#--------------------------------------------------------------------
[homing_override]                   # Z-axis homing macro (comment out if using Klicky)
axes: z
set_position_z: 0
gcode:
G90
G0 Z5 F600
G28 X Y
## Z-axis endstop position
## After testing, update X and Y values accordingly (e.g. X157, Y305)
## End pin position definition steps.
G0 X-10 Y-10 F3600               # Update X and Y values here
G28 Z
G0 Z10 F1800
    ##  Remove the "#" before corresponding configuration according to your printer size:
    ##  Rough measurement is the center of your bed.
#--------------------------------------------------------------------
    ##  250mm model, remove "#" before following line to enable configuration
    #G0 X125 Y125 Z30 F3600
#--------------------------------------------------------------------   
    ##  300mm model, remove "#" before following line to enable configuration
    #G0 X150 Y150 Z30 F3600
#--------------------------------------------------------------------
    ##  350mm model, remove "#" before following line to enable configuration
    #G0 X175 Y175 Z30 F3600
#--------------------------------------------------------------------
#####################################################################
#   3Z Leveling 
#####################################################################
[z_tilt]
##  Use Z_TILT_ADJUST command to level heater bed 
##  z_positions: Print head positions
##--------------------------------------------------------------------
##  250mm model, remove "#" before following configuration to enable
#z_positions:
#   -50, 18
#   125, 298
#   300, 18
#points:
#   30, 5
#   125, 195
#   220, 5
##--------------------------------------------------------------------
##  300mm model, remove "#" before following configuration to enable
#z_positions:
#   -50, 18
#   150, 348
#   350, 18
#points:
#   30, 5
#   150, 245
#   270, 5
##--------------------------------------------------------------------
##  350mm model, remove "#" before following configuration to enable
#z_positions:
#   -50, 18
#   175, 398
#   400, 18
#points:
#   30, 5
#   175, 295
#   320, 5
#--------------------------------------------------------------------
speed: 100                   # Leveling speed
horizontal_move_z: 10        # Starting Z height
retry_tolerance: 0.0075      # Sample tolerance
retries: 5                   # Retries when exceeding tolerance
#####################################################################
#                      FLY-Mini 12864 LCD
#####################################################################
[board_pins]
aliases:
    EXP1_1=PE12, EXP1_3=PB2,  EXP1_5=PC14,   EXP1_7=PG14,  EXP1_9=<GND>,
    EXP1_2=PE13, EXP1_4=PG8,  EXP1_6=PC13,   EXP1_8=PG13,  EXP1_10=<5V>,
    # EXP2 header
    EXP2_1=PA6, EXP2_3=PB7,  EXP2_5=PB6,  EXP2_7=PG15,   EXP2_9=<GND>,
    EXP2_2=PA5, EXP2_4=PA4,  EXP2_6=PA7,  EXP2_8=<RST>,  EXP2_10=<NC>,
#--------------------------------------------------------------------    
#[display]
#lcd_type: uc1701                # Display driver type
#cs_pin: EXP1_3                  # Display chip select pin
#a0_pin: EXP1_4                  # Display data pin
#rst_pin: EXP1_5                 # Display reset pin
#contrast: 63                    # Contrast
#encoder_pins: ^EXP2_5, ^!EXP2_3 # Rotary encoder pins
#click_pin: ^!EXP1_2             # Encoder button pin
#spi_bus: spi1                   # SPI channel must be specified
#--------------------------------------------------------------------
#####For FLY Mini12864
#[neopixel fly_mini12864]
#pin: EXP1_6                     # Display backlight pin
#chain_count: 3
#initial_RED: 0.5                # Red LED brightness (range: 0-1)
#initial_GREEN: 0.5              # Green LED brightness (range: 0-1)
#initial_BLUE: 0.5               # Blue LED brightness (range: 0-1)
#color_order: RGB                # Color order
#####################################################################
#                          Idle Bed Shutdown
#####################################################################
[idle_timeout]
timeout: 1800                # Disable heater bed after 30 minutes of inactivity
#####################################################################
#                           Custom G-code Macros                    #
#####################################################################
[gcode_macro PRINT_START]          # PRINT_START macro to run at print start
gcode:
    G92 E0                         # Reset extruder
    BED_MESH_CLEAR                 # Unload mesh
    G28                            # Home all axes
    Z_TILT_ADJUST                  #龙门架 level
    G28                            # Home all axes again
    G1 Z20 F3000                   # Move nozzle away from bed
    BED_MESH_PROFILE LOAD=default  # Load mesh
#--------------------------------------------------------------------
[gcode_macro PRINT_HUAXIAN]        # PRINT_HUAXIAN macro to run after PRINT_START
gcode:
    G1 Z5 F3000 
    G92 E0;              # Reset extruder
    G90                  # Set absolute coordinates
    G0 X5 Y1 F6000       # Move to X5 Y1 at 100mm/s (F6000 = 6000mm/min)
    G0 Z0.4              # Move Z to 0.4
    G91                  # Set relative coordinates
    G1 X100 E20 F1200;   # Extrude 100mm, change F to adjust extrusion rate
    G1 Y1                # Move Y 1mm
    G1 X-100 E20 F1200;  # Extrude back 100mm, change F to adjust rate
    G0 z5                # Raise Z 5mm
    G1 E-5.0 F3600       # Retract filament
    G92 E0;              # Reset extruder
    G90                  # Set absolute coordinates 
#--------------------------------------------------------------------
[gcode_macro PRINT_END]            # PRINT_END macro to run at print end
gcode:
    #   Get Boundaries
    {% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
    {% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
    {% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
    
    #   Check end position to determine safe movement directions
    {% if printer.toolhead.position.x < (max_x - 20) %}
        {% set x_safe = 20.0 %}
    {% else %}
        {% set x_safe = -20.0 %}
    {% endif %}
    {% if printer.toolhead.position.y < (max_y - 20) %}
        {% set y_safe = 20.0 %}
    {% else %}
        {% set y_safe = -20.0 %}
    {% endif %}
    {% if printer.toolhead.position.z < (max_z - 2) %}
        {% set z_safe = 2.0 %}
    {% else %}
        {% set z_safe = max_z - printer.toolhead.position.z %}
    {% endif %}
    M400                              # Wait for buffer to clear
    G92 E0                            # Reset extruder
    G1 E-10.0 F3600                   # Retract filament
    G91                               # Relative positioning
    G0 Z{z_safe} F3600                # Raise gantry
    G0 X{x_safe} Y{y_safe} F20000     # Move nozzle to avoid stringing
    M104 S0                           # Turn off extruder
    M140 S0                           # Turn off bed
    M106 S0                           # Turn off part fan
    G90                               # Set absolute coordinates
    G0 X{max_x / 2} Y{max_y} F3600    # Park nozzle at rear
    BED_MESH_CLEAR                    # Unload mesh
Loading...