Files
voron2.4-config/printer_data/config/printer.cfg
T

1041 lines
38 KiB
INI

# This file contains common pin mappings for the BigTreeTech Octopus V1.
# To use this config, the firmware should be compiled for the STM32F446 with a "32KiB bootloader"
# Enable "extra low-level configuration options" and select the "12MHz crystal" as clock reference
# after running "make", copy the generated "klipper/out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the OctoPus with that SD card.
# See docs/Config_Reference.md for a description of parameters.
## Voron Design VORON2 250/300/350mm BigTreeTech OctoPus V1 TMC2209 UART config
## *** THINGS TO CHANGE/CHECK: ***
## MCU paths [mcu] section
## Thermistor types [extruder] and [heater_bed] sections - See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types
## Hotend heater pin [extruder] section
## Z Endstop Switch location [safe_z_home] section
## Homing end position [gcode_macro G32] section
## Z Endstop Switch offset for Z0 [stepper_z] section
## Stepper Z1 enable pin [stepper_z1] section
## Probe points [quad_gantry_level] section
## Min & Max gantry corner postions [quad_gantry_level] section
## PID tune [extruder] and [heater_bed] sections
## Probe pin [probe] section
## Fine tune E steps [extruder] section
[include stealthburner_leds.cfg]
[include KAMP_Settings.cfg]
#[include inputShaper.cfg]
[include motorsCalibrate.cfg]
[include cartographer.cfg]
[include ebb36.cfg]
[include homing.cfg]
[exclude_object]
[force_move]
enable_force_move: true
[mcu]
## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify
##--------------------------------------------------------------------
serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2B0024001150304235343520-if00
restart_method: command
##--------------------------------------------------------------------
[printer]
kinematics: corexy
max_velocity: 750
max_accel: 12000 #Max 4000
max_z_velocity: 30 #Max 15 for 12V TMC Drivers, can increase for 24V
max_z_accel: 350
square_corner_velocity: 5.0
[input_shaper]
#shaper_freq_x: 58.8
#shaper_type_x: mzv
#shaper_freq_y: 52.6
#shaper_type_y: mzv
#####################################################################
# X/Y Stepper Settings
#####################################################################
## B Stepper - Left
## Connected to MOTOR_0
## Endstop connected to DIAG_0
[stepper_x]
step_pin: PF13
dir_pin: PF12
enable_pin: !PF14
rotation_distance: 40
microsteps: 32
full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_min: 0
##--------------------------------------------------------------------
##Uncomment below for 250mm build
position_endstop: 0
position_max: 254
## Uncomment for 300mm build
#position_endstop: 300
#position_max: 300
## Uncomment for 350mm build
#position_endstop: 350
#position_max: 350
##--------------------------------------------------------------------
homing_speed: 80 #Max 100
homing_retract_dist: 0
homing_positive_dir: false
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_x]
diag_pin: ^PG6
uart_pin: PC4
interpolate: true
run_current: 1.4
sense_resistor: 0.110
driver_SGTHRS: 150
## A Stepper - Right
## Connected to MOTOR_1
## Endstop connected to DIAG_1
[stepper_y]
step_pin: PG0
dir_pin: PG1
enable_pin: !PF15
rotation_distance: 40
microsteps: 32
full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper
endstop_pin: PG9
position_min: 0
##--------------------------------------------------------------------
## Uncomment for 250mm build
position_endstop: 253
position_max: 253
## Uncomment for 300mm build
#position_endstop: 300
#position_max: 300
## Uncomment for 350mm build
#position_endstop: 350
#position_max: 350
##--------------------------------------------------------------------
homing_speed: 100 #Max 100
homing_retract_dist: 0
homing_positive_dir: true
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_y]
uart_pin: PD11
interpolate: true
run_current: 1.4
sense_resistor: 0.110
stealthchop_threshold: 0
#####################################################################
# Z Stepper Settings
#####################################################################
## Z0 Stepper - Front Left
## Connected to MOTOR_2
## Endstop connected to DIAG_2
[stepper_z]
step_pin: PF11
dir_pin: PG3
enable_pin: !PG5
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
endstop_pin: probe:z_virtual_endstop
## 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.5
##--------------------------------------------------------------------
## Uncomment below for 250mm build
position_max: 230
## Uncomment below for 300mm build
#position_max: 260
## Uncomment below for 350mm build
#position_max: 310
##--------------------------------------------------------------------
position_min: -1
homing_speed: 100
second_homing_speed: 2
homing_retract_dist: 0
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z]
uart_pin: PC6
interpolate: true
run_current: 1.4
sense_resistor: 0.110
## Z1 Stepper - Rear Left
## Connected to MOTOR_3
[stepper_z1]
step_pin: PG4
dir_pin: !PC1
## Octopus 1.0 & 1.1. Octopus PRO 1.0
enable_pin: !PA0
## Octopus PRO 1.1
#enable_pin: !PA2
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z1]
uart_pin: PC7
interpolate: true
run_current: 1.4
sense_resistor: 0.110
## Z2 Stepper - Rear Right
## Connected to MOTOR_4
[stepper_z2]
step_pin: PF9
dir_pin: PF10
enable_pin: !PG2
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z2]
uart_pin: PF2
interpolate: true
run_current: 1.4
sense_resistor: 0.110
## Z3 Stepper - Front Right
## Connected to MOTOR_5
[stepper_z3]
step_pin: PC13
dir_pin: !PF0
enable_pin: !PF1
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z3]
uart_pin: PE4
interpolate: true
run_current:1.4
sense_resistor: 0.110
[filament_switch_sensor switch_sensor]
switch_pin: ^PG12
pause_on_runout: True
runout_gcode:
PAUSE # [pause_resume] is required in printer.cfg
M117 Filament switch runout
insert_gcode:
M117 Filament switch inserted
[filament_motion_sensor encoder_sensor]
switch_pin: ^PG13
detection_length: 4.5 # accuracy of motion sensor 2.88mm
extruder: extruder
pause_on_runout: False
runout_gcode:
PAUSE # [pause_resume] is required in printer.cfg
M117 Filament encoder runout
insert_gcode:
M117 Filament encoder inserted
#####################################################################
# Bed Heater
#####################################################################
## SSR Pin - HE1
## Thermistor - TB
[heater_bed]
## Uncomment the following line if using the default SSR wiring from the docs site
heater_pin: PA3
## Other wiring guides may use BED_OUT to control the SSR. Uncomment the following line for those cases
#heater_pin: PA1
## Check what thermistor type you have. See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types.
## Use "Generic 3950" for Keenovo heaters
sensor_type: Generic 3950
sensor_pin: PF3
## Adjust max_power so it doesn't exceed the SSR rating. The Omron G3NA-210B-DC5 SSR is rated at 4 amps without a heatsink.
## The formula is "4 / (Wattage_of_bed_heater / Mains_voltage) = max_power"
## If max_power is greater than 1.0, use 1.0
max_power: 0.8
min_temp: 0
max_temp: 120
control: pid
pid_kp: 58.437
pid_ki: 2.347
pid_kd: 363.769
[bed_mesh]
zero_reference_position: 125, 125 # center of your bed
speed: 400
horizontal_move_z: 5
mesh_min: 35, 30
mesh_max: 215, 200
probe_count: 30,30
algorithm: bicubic
adaptive_margin: 5
#####################################################################
# Fan Control
#####################################################################
## Print Cooling Fan - FAN0
# [fan]
# pin: PA8
# kick_start_time: 0.5
# ## Depending on your fan, you may need to increase this value
# ## if your fan will not start. Can change cycle_time (increase)
# ## if your fan is not able to slow down effectively
# off_below: 0.10
## Hotend Fan - FAN1
# [heater_fan hotend_fan]
# pin: PE5
# max_power: 1.0
# kick_start_time: 0.5
# heater: extruder
# heater_temp: 50.0
## If you are experiencing back flow, you can reduce fan_speed
#fan_speed: 1.0
## Controller fan - FAN2
[controller_fan controller_fan_1]
pin: PD12
kick_start_time: 0.5
idle_speed: 0.6
max_power: 1
heater: heater_bed
[fan_generic front]
pin: PE5
[temperature_sensor ebb36_mcu]
sensor_type: temperature_mcu
sensor_mcu: EBBCan
min_temp: 0
max_temp: 100
# ------------------------------
# Wentylator sterowany temperaturą MCU
# ------------------------------
[temperature_fan chamber_fan]
pin: PD14
sensor: ebb36_mcu
min_temp: 40
target_temp: 50
max_temp: 80
min_speed: 0
max_speed: 1.0
shutdown_speed: 0.0
cycle_time: 0.0005
hardware_pwm: False
kick_start_time: 0
gcode_id: C
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
max_temp: 100
[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
max_temp: 100
[fan_generic nevermore]
## Nevermore - FAN5 on Octopus
## Adjust if you use a different board or a different terminal.
pin: PD13
#####################################################################
# Homing and Gantry Adjustment Routines
#####################################################################
[idle_timeout]
timeout: 1800
# [safe_z_home]
# ## XY Location of the Z Endstop Switch
# ## Update -10,-10 to the XY coordinates of your endstop pin
# ## (such as 157,305) after going through Z Endstop Pin
# ## Location Definition step.
# home_xy_position: 125, 125
# speed:100
# z_hop:10
# Use QUAD_GANTRY_LEVEL to level a gantry.
# Min & Max gantry corners - measure from nozzle at MIN (0,0) and
# MAX (250, 250), (300,300), or (350,350) depending on your printer size
# to respective belt positions
[quad_gantry_level]
#--------------------------------------------------------------------
## Gantry Corners for 250mm Build
## Uncomment for 250mm build
gantry_corners:
-60,-10
310, 320
## Probe points
points:
50,25
50,210
220,210
220,25
## Gantry Corners for 300mm Build
## Uncomment for 300mm build
#gantry_corners:
# -60,-10
# 360,370
## Probe points
#points:
# 50,25
# 50,225
# 250,225
# 250,25
## Gantry Corners for 350mm Build
## Uncomment for 350mm build
#gantry_corners:
# -60,-10
# 410,420
## Probe points
#points:
# 50,25
# 50,275
# 300,275
# 300,25
#--------------------------------------------------------------------
speed: 300
horizontal_move_z: 10
retries: 5
retry_tolerance: 0.0075
max_adjust: 10
########################################
# EXP1 / EXP2 (display) pins
########################################
[board_pins]
aliases:
# EXP1 header
EXP1_1=PE8, EXP1_2=PE7,
EXP1_3=PE9, EXP1_4=PE10,
EXP1_5=PE12, EXP1_6=PE13, # Slot in the socket on this side
EXP1_7=PE14, EXP1_8=PE15,
EXP1_9=<GND>, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PA6, EXP2_2=PA5,
EXP2_3=PB1, EXP2_4=PA4,
EXP2_5=PB2, EXP2_6=PA7, # Slot in the socket on this side
EXP2_7=PC15, EXP2_8=<RST>,
EXP2_9=<GND>, EXP2_10=<5V>
#####################################################################
# Displays
#####################################################################
## Uncomment the display that you have
#--------------------------------------------------------------------
## RepRapDiscount 128x64 Full Graphic Smart Controller
#[display]
#lcd_type: st7920
#cs_pin: EXP1_4
#sclk_pin: EXP1_5
#sid_pin: EXP1_3
#menu_timeout: 40
#encoder_pins: ^EXP2_5, ^EXP2_3
#click_pin: ^!EXP1_2
#[output_pin beeper]
#pin: EXP1_1
#--------------------------------------------------------------------
## mini12864 LCD Display
#[display]
#lcd_type: uc1701
#cs_pin: EXP1_3
#a0_pin: EXP1_4
#rst_pin: EXP1_5
#encoder_pins: ^EXP2_5, ^EXP2_3
#click_pin: ^!EXP1_2
#contrast: 63
#spi_software_miso_pin: EXP2_1
#spi_software_mosi_pin: EXP2_6
#spi_software_sclk_pin: EXP2_2
## To control Neopixel RGB in mini12864 display
#[neopixel btt_mini12864]
#pin: EXP1_6
#chain_count: 3
#initial_RED: 0.1
#initial_GREEN: 0.5
#initial_BLUE: 0.0
#color_order: RGB
## Set RGB values on boot up for each Neopixel.
## Index 1 = display, Index 2 and 3 = Knob
#[delayed_gcode setdisplayneopixel]
#initial_duration: 1
#gcode:
# SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=1 TRANSMIT=0
# SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0
# SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=3
#--------------------------------------------------------------------
[virtual_sdcard]
path: ~/printer_data/gcodes
[display_status]
[pause_resume]
#####################################################################
# Macros
#####################################################################
[gcode_macro LOAD_FILAMENT]
variable_load_distance: 50
variable_purge_distance: 25
gcode:
{% set speed = params.SPEED|default(300) %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
SAVE_GCODE_STATE NAME=load_state
G91
G92 E0
G1 E{load_distance} F{max_velocity} # fast-load
G1 E{purge_distance} F{speed} # purge
RESTORE_GCODE_STATE NAME=load_state
[gcode_macro UNLOAD_FILAMENT]
variable_unload_distance: 50
variable_purge_distance: 25
gcode:
{% set speed = params.SPEED|default(300) %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
SAVE_GCODE_STATE NAME=unload_state
G91
G92 E0
G1 E{purge_distance} F{speed} # purge
G1 E-{unload_distance} F{max_velocity} # fast-unload
RESTORE_GCODE_STATE NAME=unload_state
[gcode_macro start_heating]
gcode:
STATUS_HOMING
G28
STATUS_HEATING
nvmOn
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=50
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=115
SET_TEMPERATURE_FAN_TARGET TEMPERATURE_FAN=chamber TARGET=55
SET_FAN_SPEED FAN=front SPEED=0.55
G1 Z50
M106 S79
[gcode_macro nvmOn]
gcode:
SET_FAN_SPEED FAN=nevermore SPEED=1
[gcode_macro nvmOff]
gcode:
SET_FAN_SPEED FAN=nevermore SPEED=0
[gcode_macro PARK]
gcode:
{% set th = printer.toolhead %}
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y//2} Z30
[gcode_macro G32]
gcode:
SAVE_GCODE_STATE NAME=STATE_G32
G90
G28
QUAD_GANTRY_LEVEL
G28
PARK
RESTORE_GCODE_STATE NAME=STATE_G32
[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customise for your slicer of choice
gcode:
# Parameters
{% set bedtemp = params.BED|int %}
{% set hotendtemp = params.EXTRUDER|int %}
{% set chambertemp = params.CHAMBER|default(0)|int %}
SET_FAN_SPEED FAN=front SPEED=0.55
STATUS_HOMING
G28
STATUS_HEATING
M190 S{bedtemp}
; wait for bed temp
{% if bedtemp > 95 %}
nvmOn
TEMPERATURE_WAIT SENSOR="temperature_fan chamber" MINIMUM={chambertemp} ; wait for chamber temp
{% endif %}
STATUS_MESHING
QUAD_GANTRY_LEVEL
BED_MESH_CALIBRATE
M109 S150
CLEAN_NOZZLE
CARTOGRAPHER_TOUCH_HOME
M109 S{hotendtemp}
{% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %}
; move nozzle away from bed
#LINE_PURGE
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
gcode:
# safe anti-stringing move coords
{% set th = printer.toolhead %}
{% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
{% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
{% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
SAVE_GCODE_STATE NAME=STATE_PRINT_END
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-8.0 F1800 ; retract filament
# STATUS_CLEANING
# clean_nozzle
TURN_OFF_HEATERS
nvmOff
G90 ; absolute positioning
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear
M107 ; turn off fan
BED_MESH_CLEAR
# The purpose of the SAVE_GCODE_STATE/RESTORE_GCODE_STATE
# command pair is to restore the printer's coordinate system
# and speed settings since the commands above change them.
# However, to prevent any accidental, unintentional toolhead
# moves when restoring the state, explicitly set MOVE=0.
RESTORE_GCODE_STATE NAME=STATE_PRINT_END MOVE=0
# Home, get position, throw around toolhead, home again.
# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
# We only measure to a full step to accomodate for endstop variance.
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
[gcode_macro TEST_SPEED]
gcode:
# Speed
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations = params.ITERATIONS|default(5)|int %}
# Acceleration
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound = params.BOUND|default(20)|int %}
# Size for small pattern box
{% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
# Large pattern
# Max positions, inset by BOUND
{% set x_min = printer.toolhead.axis_minimum.x + bound %}
{% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% set y_min = printer.toolhead.axis_minimum.y + bound %}
{% set y_max = printer.toolhead.axis_maximum.y - bound %}
# Small pattern at center
# Find X/Y center point
{% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
{% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
# Set small pattern box around center point
{% set x_center_min = x_center - (smallpatternsize/2) %}
{% set x_center_max = x_center + (smallpatternsize/2) %}
{% set y_center_min = y_center - (smallpatternsize/2) %}
{% set y_center_max = y_center + (smallpatternsize/2) %}
# Save current gcode state (absolute/relative, etc)
SAVE_GCODE_STATE NAME=TEST_SPEED
# Output parameters to g-code terminal
{ action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
# Home and get position for comparison later:
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28
# QGL if not already QGLd (only if QGL section exists in config)
{% if printer.configfile.settings.quad_gantry_level %}
{% if printer.quad_gantry_level.applied == False %}
QUAD_GANTRY_LEVEL
G28 Z
{% endif %}
{% endif %}
# Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24)
G90
G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60}
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28 X Y
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION
# Go to starting position
G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}
# Set new limits
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
{% for i in range(iterations) %}
# Large pattern diagonals
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Large pattern box
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Small pattern diagonals
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
# Small patternbox
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
{% endfor %}
# Restore max speed/accel/accel_to_decel to their configured values
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
# Re-home and get position again for comparison:
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12
# Go to XY home positions (in case your homing override leaves it elsewhere)
G90
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION
# Restore previous gcode state (absolute/relative, etc)
RESTORE_GCODE_STATE NAME=TEST_SPEED
[gcode_macro CLEAN_NOZZLE_TEST]
gcode:
{% set brush_x_pos = 110 %} ; ### POZYCJA X SZCZOTKI - DO KONFIGURACJI ###
{% set brush_y_pos = 249 %} ; ### POZYCJA Y SZCZOTKI - DO KONFIGURACJI ###
{% set brush_z_offset = 0.2 %} ; ### OFFSET Z NAD SZCZOTKA (POCZATKOWY) - DO KONFIGURACJI ###
{% set clean_x_range = -45 %} ; ### ZAKRES RUCHU X (AMPLITUDA) - DO KONFIGURACJI ###
{% set clean_y_range = 2 %} ; ### ZAKRES RUCHU Y (AMPLITUDA) - DO KONFIGURACJI ### ; **NOWE: Zakres Y**
{% set clean_passes = 10 %} ; ### ILOSC PRZEJSC CZYSZCZACYCH (CYKLI Y) - DO KONFIGURACJI ### ; **Zmienione na CYKLE Y**
{% set clean_x_steps_per_pass = 20 %} ; ### ILOSC KROKOW X NA PRZEJSCIE - DO KONFIGURACJI ### ; **NOWE: Kroki X w przejściu**
{% set clean_speed = 400 %} ; ### PREDKOSC RUCHU CZYSZCZENIA - DO KONFIGURACJI ###
{% set shake_z_offset = 0.2 %} ; ### OFFSET Z DLA WSTRZASANIA - DO KONFIGURACJI ###
{% set shake_x_range = 2 %} ; ### ZAKRES RUCHU X WSTRZASANIA - DO KONFIGURACJI ###
{% set shake_y_range = 2 %} ; ### ZAKRES RUCHU Y WSTRZASANIA - DO KONFIGURACJI ###
{% set shake_speed = 700 %} ; ### PREDKOSC WSTRZASANIA - DO KONFIGURACJI ###
{% set shake_acceleration = 15000 %} ; ### PRZYSPIESZENIE WSTRZASANIA - DO KONFIGURACJI ###
{% set nozzle_temp_clean = params.TEMP|default(printer.configfile.config.extruder.nozzle_temp|int + 10) %} ; ### TEMPERATURA DYSZY DO CZYSZCZENIA - MOZNA PODAC PARAMETR TEMP=... ###
SAVE_GCODE_STATE NAME=clean_nozzle_state
M109 S{nozzle_temp_clean} ; Rozgrzej dyszę do temperatury czyszczenia
G28 X Y ; Wyhomuj X i Y
G0 Z{brush_z_offset} F{clean_speed} ; Przejdź na wysokość nad szczotką
G0 X{brush_x_pos - clean_x_range/2} Y{brush_y_pos} F{clean_speed} ; Start X, Y srodek zakresu Y
{% for y_pass in range(clean_passes) %} ; Pętla dla przejść Y (cykli sinusoidalnych Y)
{% for x_step in range(clean_x_steps_per_pass) %} ; Kroki w ruchu X (przybliżenie sinusoidy X)
{% set x_pos = brush_x_pos - clean_x_range/2 + (clean_x_range * x_step / (clean_x_steps_per_pass - 1)) %} ; Pozycja X w kroku
{% set y_offset = clean_y_range/2 * sin(2 * pi * x_step / clean_x_steps_per_pass + (y_pass * pi / clean_passes)) %} ; Sinusoidalny offset Y - **KLUCZOWA ZMIANA!**
{% set current_y = brush_y_pos + y_offset %} ; Aktualna pozycja Y
G1 X{x_pos} Y{current_y} F{clean_speed} ; Ruch z sinusoidalnym Y i liniowym X (kroki X)
{% endfor %}
{% endfor %}
G0 Z{shake_z_offset} F{shake_speed} ; Podnieś Z na wysokość wstrząsania
{% for i in range(5) %} ; Ruchy wstrząsające
G1 X{brush_x_pos + shake_x_range} Y{brush_y_pos + shake_y_range} F{shake_speed} ACCEL={shake_acceleration}
G1 X{brush_x_pos - shake_x_range} Y{brush_y_pos - shake_y_range} F{shake_speed} ACCEL={shake_acceleration}
G1 X{brush_x_pos - shake_x_range} Y{brush_y_pos + shake_y_range} F{shake_speed} ACCEL={shake_acceleration}
G1 X{brush_x_pos + shake_x_range} Y{brush_y_pos - shake_y_range} F{shake_speed} ACCEL={shake_acceleration}
{% endfor %}
M104 S0 ; Wyłącz grzanie dyszy
RESTORE_GCODE_STATE NAME=clean_nozzle_state
[gcode_macro CLEAN_NOZZLE]
variable_start_x: 110
variable_start_y: 250.5
variable_start_z: 0.3
variable_wipe_dist: -45
variable_wipe_qty: 10
variable_wipe_spd: 400
variable_raise_distance: 15
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
G90 ; absolute positioning
## Move nozzle to start position
G1 X{start_x} Y{start_y} F6000
G1 Z{start_z} F1500
## Wipe nozzle
{% for wipes in range(1, (wipe_qty + 1)) %}
G1 X{start_x + wipe_dist} F{wipe_spd * 60}
G1 X{start_x} F{wipe_spd * 60}
{% endfor %}
## Raise nozzle
G1 Z{raise_distance}
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
# Parameters
{% set z = params.Z|default(10)|int %} ; z hop amount
{% 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=encoder_sensor 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 %}
G90 ; absolute positioning
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
M104 S0 ; turn off hotend
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
{% endif %}
[gcode_macro LINE_PURGE]
description: A purge macro that adapts to be near your actual printed objects
variable_adaptive_enable: False # Change to False if you'd like the purge to be in the same spot every print
variable_z_height: 10 # Height above the bed to purge
variable_purge_amount: 100 # Amount of filament in millimeters to purge
variable_line_length: 1 # Overall desired length of purge line in millimeters, around 1/5th of X axis length is a good starting value
variable_flow_rate: 35 # Desired flow rate in mm3/s (Around 12 for standard flow hotends, around 24 for high flow hotends)
variable_x_default: 115 # Default X location to purge. If adaptive_enable is True, this is overwritten
variable_y_default: 251 # Default Y location to purge. If adaptive_enable is True, this is overwritten
variable_distance_to_object_y: 10 # Y distance in millimeters away from the print area for purging. Must be less than or equal to y_default if adaptive_enable is False
### This section is for those who are using Moonraker's Update Manager for KAMP, or want a more verbose macro. ###
variable_display_parameters: True # Display macro paramters in the console, useful for debugging the SETUP_LINE_PURGE call, or more verbosity.
gcode:
{% if display_parameters == True %}
{ action_respond_info("adaptive_enable : %d" % (adaptive_enable)) }
{ action_respond_info("z_height : %f" % (z_height)) }
{ action_respond_info("purge_amount : %f" % (purge_amount)) }
{ action_respond_info("line_length : %f" % (line_length)) }
{ action_respond_info("flow_rate : %f" % (flow_rate)) }
{ action_respond_info("x_default : %f" % (x_default)) }
{ action_respond_info("y_default : %f" % (y_default)) }
{ action_respond_info("distance_to_object_y : %f" % (distance_to_object_y)) }
{% endif %}
{% if adaptive_enable == True %}
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %}
{% set x_origin = (all_points | map(attribute=0) | min | default(x_default)) %}
{% set y_origin = (all_points | map(attribute=1) | min | default(y_default)) %}
{% set x_origin = ([x_origin, 0] | max) %}
{% set y_origin = ([y_origin, 0] | max) %}
{% else %}
{% set x_origin = x_default | float %}
{% set y_origin = y_default | float %}
{% endif %}
{% set nozzle_dia = printer.configfile.config.extruder.nozzle_diameter | float %}
{% set cross_section = nozzle_dia * z_height | float %}
{% set purge_move_speed = (cross_section * flow_rate) * 60 | float %}
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %}
G92 E0 # Reset extruder
G0 F{travel_speed} # Set travel speed
G90 # Absolute positioning
G0 X{x_origin} Y{y_origin - distance_to_object_y} # Move to purge position
G0 Z{z_height} # Move to purge Z height
M83 # Relative extrusion mode
G1 X{x_origin + line_length} E{purge_amount} F{purge_move_speed} # Purge line
G1 E-.5 F2100 # Retract
G92 E0 # Reset extruder distance
M82 # Absolute extrusion mode
G0 Z{z_height * 2} F{travel_speed} # Z hop
[gcode_macro SETUP_LINE_PURGE]
gcode:
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=display_parameters VALUE={params.DISPLAY_PARAMETERS|default(True)|int}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=adaptive_enable VALUE={params.ADAPTIVE_ENABLE|default(False)|int}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=z_height VALUE={params.Z_HEIGHT|default(0.4)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=purge_amount VALUE={params.PURGE_AMOUNT|default(40)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=line_length VALUE={params.LINE_LENGTH|default(50)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=flow_rate VALUE={params.FLOW_RATE|default(12)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=x_default VALUE={params.X_DEFAULT|default(10)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=y_default VALUE={params.Y_DEFAULT|default(10)|float}
SET_GCODE_VARIABLE MACRO=LINE_PURGE VARIABLE=distance_to_object_y VALUE={params.DISTANCE_TO_OBJECT_Y|default(10)|float}
[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=encoder_sensor 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 positioning
M83 ; relative extruder positioning
{% 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 %}
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position
BASE_RESUME ; resume print
{% endif %}
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.065255, 0.071201, 0.093025, 0.069855, 0.055670, 0.065816, 0.054811, 0.059380, 0.096045, 0.082954
#*# 0.045501, 0.061980, 0.081147, 0.051661, 0.042448, 0.052143, 0.034476, 0.034945, 0.076122, 0.052484
#*# 0.035889, 0.046636, 0.060898, 0.033834, 0.022608, 0.027654, 0.011200, 0.011407, 0.056646, 0.023887
#*# 0.026232, 0.036250, 0.049644, 0.026037, 0.013614, 0.017851, 0.003126, 0.001788, 0.036743, 0.005884
#*# 0.022834, 0.029478, 0.041896, 0.014559, 0.002286, 0.008549, -0.014509, -0.014010, 0.021836, -0.007537
#*# 0.017651, 0.027919, 0.039732, 0.012832, 0.005339, 0.011024, -0.012677, -0.018084, 0.015354, -0.014114
#*# 0.017482, 0.025719, 0.031431, -0.002244, -0.006149, 0.000613, -0.027338, -0.038645, 0.003335, -0.025026
#*# 0.023578, 0.031460, 0.032923, 0.003216, -0.015895, -0.012293, -0.039144, -0.044099, -0.004723, -0.030724
#*# 0.033086, 0.037750, 0.035573, 0.005872, -0.017743, -0.026667, -0.051426, -0.053878, -0.015555, -0.042167
#*# 0.046162, 0.042762, 0.042831, 0.006357, -0.014295, -0.017035, -0.045508, -0.051700, -0.015148, -0.033815
#*# x_count = 10
#*# y_count = 10
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = bicubic
#*# tension = 0.2
#*# min_x = 35.0
#*# max_x = 215.0
#*# min_y = 30.0
#*# max_y = 200.0
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 26.908
#*# pid_ki = 2.360
#*# pid_kd = 76.690
#*#
#*# [input_shaper]
#*# shaper_type_x = mzv
#*# shaper_freq_x = 54.4
#*# shaper_type_y = mzv
#*# shaper_freq_y = 41.6
#*#
#*# [scanner]
#*# mode = touch
#*# scanner_touch_threshold = 1750
#*# scanner_touch_speed = 3
#*#
#*# [scanner model default]
#*# model_coef = 1.533462783731469,
#*# 1.8643346087769017,
#*# 0.7264425159866749,
#*# 0.2600510592900792,
#*# 0.4323687234837437,
#*# 0.6366512971376294,
#*# -0.32513435558267295,
#*# -0.6915039243473435,
#*# 0.28312010405131427,
#*# 0.3813900407842316
#*# model_domain = 3.2345754756221813e-07,3.3470590535180124e-07
#*# model_range = 0.200417,5.100417
#*# model_temp = 31.440061
#*# model_offset = 0.00000
#*# model_mode = touch
#*# model_fw_version = CARTOGRAPHER 5.1.0
#*#
#*# [cartographer touch_model default]
#*# threshold = 1198
#*# speed = 2
#*# z_offset = -0.05
#*#
#*# [cartographer scan_model default]
#*# coefficients = 1.4944050196772214,1.973772362872906,0.8318341605237017,0.3579972971231557,0.4156877755001953,0.5113538029259799,-0.2105536368067083,-0.3979665976652252,0.2681252914803734,0.2550376181770316
#*# domain = 3.2378877042937397e-07,3.350953826629849e-07
#*# z_offset = 0
#*# reference_temperature = 32.27