add orca slicer
add klipper files
This commit is contained in:
50
modules/services/printer/cfgs/CALIBRATION.cfg
Normal file
50
modules/services/printer/cfgs/CALIBRATION.cfg
Normal file
@@ -0,0 +1,50 @@
|
||||
[gcode_macro PID_TEST_BED]
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set TARGETTEMP = params.TEMP|default(70)|int %}
|
||||
|
||||
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
|
||||
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
|
||||
G28
|
||||
G90
|
||||
G1 X{max_x/2} Y{max_y/2} Z40 F6000
|
||||
PID_CALIBRATE HEATER=heater_bed TARGET={TARGETTEMP}
|
||||
|
||||
[gcode_macro PID_TEST_HOTEND]
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set TARGETTEMP = params.TEMP|default(245)|int %}
|
||||
|
||||
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
|
||||
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
|
||||
G28
|
||||
G90
|
||||
G1 X{max_x/2} Y{max_y/2} Z10 F6000
|
||||
M106 S64
|
||||
PID_CALIBRATE HEATER=extruder TARGET={TARGETTEMP}
|
||||
M107 ; Turn off print cooling fan
|
||||
|
||||
# TODO test this
|
||||
[gcode_macro PID_TEST_ALL]
|
||||
gcode:
|
||||
PID_TEST_BED
|
||||
PID_TEST_HOTEND
|
||||
SAVE_CONFIG
|
||||
|
||||
[gcode_macro DO_PROBE_CALIBRATE]
|
||||
gcode:
|
||||
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=60
|
||||
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=180
|
||||
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=60
|
||||
TEMPERATURE_WAIT SENSOR=extruder MINIMUM=180
|
||||
G28
|
||||
PROBE_CALIBRATE
|
||||
|
||||
[gcode_macro DO_CREATE_MESH]
|
||||
gcode:
|
||||
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=60
|
||||
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=180
|
||||
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=60
|
||||
TEMPERATURE_WAIT SENSOR=extruder MINIMUM=180
|
||||
G28
|
||||
_BED_MESH_CALIBRATE
|
||||
110
modules/services/printer/cfgs/MECHANICAL_GANTRY_CALIBRATION.cfg
Normal file
110
modules/services/printer/cfgs/MECHANICAL_GANTRY_CALIBRATION.cfg
Normal file
@@ -0,0 +1,110 @@
|
||||
###############################################################################
|
||||
# Source https://github.com/strayr/strayr-k-macros/blob/e0807570a66d28735cf05143b105ab4ea6d9798f/mechanical_level_tmc2209.cfg
|
||||
#
|
||||
# Mechanical Gantry Calibration
|
||||
#
|
||||
# Requires TMC2209 drivers with UART control, some tuning and perhaps
|
||||
# some printed endstops.
|
||||
#
|
||||
# Based on on (depricated) M915 and now alternate G34 from Marlin
|
||||
# I beleive Prusa use this, certainly there's older videos advising to just
|
||||
# ram the gantry at full current into the the z-max stops.
|
||||
#
|
||||
# It moves the gantry to the top of the travel, drops the current and then
|
||||
# does a force move to force the steppers to stall against the physical end
|
||||
# stops, transfering the level of the frame to the gantry.
|
||||
#
|
||||
# This is the only way to programatically level a multi-stepper single-driver
|
||||
# gantry. It may also help with a dual-driver gantry on a bed-slinger design
|
||||
# or where the plane of the bed is less trustworthy than the frame.
|
||||
#
|
||||
# It's particularly risky doing Z_TILT_ADJUST and SCREWS_TILT_CALCULATE
|
||||
# without a mechanical reference as if one side of the gantry or bed is prone
|
||||
# to droop, over time both bed and gantry will skew excessively but still read
|
||||
# as level, so this can help transfer "level" from the frame to the gantry and
|
||||
# then to the bed.
|
||||
#
|
||||
# I don't recommend doing this in a START_PRINT, I call this if a
|
||||
# SCREWS_TILT_CALCULATE shows some drift, althoughon an Ender 3 type printer
|
||||
# it's prudent to check the v-slot rollers for correct adjustment if drift is
|
||||
# observed.
|
||||
#
|
||||
# It's probably best to run this and then do SCREWS_TILT_CALCULATE
|
||||
# until the bed is really level. IF you have dual Z steppers you can then
|
||||
# use Z_TILT_ADJUST for subsequent leveling of the gantry but make sure you
|
||||
# use the same points for gantry level as you use in SCREWS_TILT_CALCULATE
|
||||
#
|
||||
# It may damage your printer if you do this at too high a current, or don't
|
||||
# have proper endstops.
|
||||
#
|
||||
# HERE BE DRAGONS!
|
||||
# YOU WERE WARNED!
|
||||
#
|
||||
# Here's a video of this in action
|
||||
# https://www.youtube.com/watch?v=aVdIeIIpUAk
|
||||
# and the endstops for 2020 v-slot
|
||||
# https://www.thingiverse.com/thing:4848479
|
||||
|
||||
[gcode_macro MECHANICAL_GANTRY_CALIBRATION]
|
||||
gcode:
|
||||
### SET THIS DEFAULT CARFULLY - start really low
|
||||
{% set my_current = params.CURRENT|default(0.20)|float %} ; adjust crash current on the fly :D
|
||||
###
|
||||
{% set oldcurrent = printer.configfile.settings["tmc2209 stepper_z"].run_current %}
|
||||
{% set oldhold = printer.configfile.settings["tmc2209 stepper_z"].hold_current %}
|
||||
{% set x_max = printer.toolhead.axis_maximum.x %}
|
||||
{% set y_max = printer.toolhead.axis_maximum.y %}
|
||||
{% set z_max = printer.toolhead.axis_maximum.z %}
|
||||
{% set fast_move_z = printer.configfile.settings["printer"].max_z_velocity %}
|
||||
{% set fast_move = printer.configfile.settings["printer"].max_velocity %}
|
||||
M117 {printer.homed_axes}
|
||||
{% if printer.homed_axes != 'xyz' %}
|
||||
G28 ; Home All Axes
|
||||
{% endif %}
|
||||
G90 ; absolute
|
||||
G0 X{x_max / 2} Y{y_max / 2} F{fast_move * 30 } ;put toolhead in the center of the gantry
|
||||
|
||||
G0 Z{z_max -5} F{fast_move_z * 60 } ; go to the Z-max - 5 at speed max z speed ; CHANGED
|
||||
|
||||
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={my_current} ; drop current on Z stepper
|
||||
|
||||
{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
|
||||
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={my_current} ; drop current
|
||||
{% endif %}
|
||||
|
||||
CONDITIONAL_BEEP I=1
|
||||
G4 P200 ; Probably not necessary, it is here just for sure
|
||||
|
||||
SET_KINEMATIC_POSITION Z={z_max - 25} ; Trick printer into beleiving the gantry is 25mm lower than it is ; CHANGED
|
||||
|
||||
G1 Z{z_max} F{6 * 60} ; based on above figures, there will be 20mm worth of grinding ; CHANGED
|
||||
CONDITIONAL_BEEP I=2
|
||||
G4 P10000 ; wait 10 seconds
|
||||
G1 Z{z_max -6} F{6 * 60} ; move 4mm down
|
||||
CONDITIONAL_BEEP I=3
|
||||
G4 P200 ; same as the first one
|
||||
|
||||
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={oldcurrent} HOLDCURRENT={oldhold}
|
||||
|
||||
{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
|
||||
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={oldcurrent} HOLDCURRENT={oldhold} ; reset current
|
||||
{% endif %}
|
||||
|
||||
G1 Z{z_max -30} F{6 * 60} ; move to 30mm below z-max to allow homing movement
|
||||
|
||||
G4 P200 ; same as the first one
|
||||
G28 Z ; we MUST home again as the ganty is really in the wrong place.
|
||||
|
||||
[gcode_macro G34]
|
||||
gcode:
|
||||
MECHANICAL_GANTRY_CALIBRATION
|
||||
|
||||
[menu __main __setup __calib __mech_gantry_calibrate]
|
||||
type: command
|
||||
enable: {not printer.idle_timeout.state == "Printing"}
|
||||
name: G34 Gantry Level
|
||||
gcode:
|
||||
G34
|
||||
|
||||
[force_move]
|
||||
enable_force_move: true ; enable FORCE_MOVE and SET_KINEMATIC_POSITION
|
||||
54
modules/services/printer/cfgs/PARKING.cfg
Normal file
54
modules/services/printer/cfgs/PARKING.cfg
Normal file
@@ -0,0 +1,54 @@
|
||||
# Park front center
|
||||
[gcode_macro PARKFRONT]
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28 ; home if not already homed
|
||||
{% endif %}
|
||||
SAVE_GCODE_STATE NAME=PARKFRONT
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} Z{printer.toolhead.axis_maximum.z/2} F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKFRONT
|
||||
|
||||
# Park front center, but low down.
|
||||
[gcode_macro PARKFRONTLOW]
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28 ; home if not already homed
|
||||
{% endif %}
|
||||
SAVE_GCODE_STATE NAME=PARKFRONT
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} Z20 F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKFRONT
|
||||
|
||||
# Park top rear left
|
||||
[gcode_macro PARKREAR]
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28 ; home if not already homed
|
||||
{% endif %}
|
||||
SAVE_GCODE_STATE NAME=PARKREAR
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_minimum.x+10} Y{printer.toolhead.axis_maximum.y-10} Z{printer.toolhead.axis_maximum.z-50} F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKREAR
|
||||
|
||||
# Park at center of build volume
|
||||
[gcode_macro PARKCENTER]
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28 ; home if not already homed
|
||||
{% endif %}
|
||||
SAVE_GCODE_STATE NAME=PARKCENTER
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z{printer.toolhead.axis_maximum.z/2} F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKCENTER
|
||||
|
||||
# Park 15mm above center of bed
|
||||
[gcode_macro PARKBED]
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28 ; home if not already homed
|
||||
{% endif %}
|
||||
SAVE_GCODE_STATE NAME=PARKBED
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z15 F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKBED
|
||||
124
modules/services/printer/cfgs/TEST_SPEED.cfg
Normal file
124
modules/services/printer/cfgs/TEST_SPEED.cfg
Normal file
@@ -0,0 +1,124 @@
|
||||
[gcode_macro TEST_SPEED]
|
||||
# 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
|
||||
|
||||
description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU
|
||||
|
||||
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 %}
|
||||
# Minimum Cruise Ratio
|
||||
{% set min_cruise_ratio = params.MIN_CRUISE_RATIO|default(0.5)|float %}
|
||||
# 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
|
||||
{% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %}
|
||||
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MINIMUM_CRUISE_RATIO={min_cruise_ratio}
|
||||
{% else %}
|
||||
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
|
||||
{% endif %}
|
||||
|
||||
{% 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 pattern box
|
||||
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
|
||||
{% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %}
|
||||
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} MINIMUM_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio}
|
||||
{% else %}
|
||||
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}
|
||||
{% endif %}
|
||||
|
||||
# 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
|
||||
|
||||
13
modules/services/printer/cfgs/adxl-direct.cfg
Normal file
13
modules/services/printer/cfgs/adxl-direct.cfg
Normal file
@@ -0,0 +1,13 @@
|
||||
# Documentation https://www.klipper3d.org/Measuring_Resonances.html?h=adxl#configure-adxl345-with-rpi
|
||||
# Documentation https://www.klipper3d.org/RPi_microcontroller.html
|
||||
|
||||
[mcu rpi]
|
||||
serial: /tmp/klipper_host_mcu
|
||||
|
||||
[adxl345]
|
||||
cs_pin: rpi:None
|
||||
|
||||
[resonance_tester]
|
||||
accel_chip: adxl345
|
||||
probe_points: 111.5, 111.5, 20
|
||||
max_smoothing: 0.13
|
||||
29
modules/services/printer/cfgs/adxl-rp2040.cfg
Normal file
29
modules/services/printer/cfgs/adxl-rp2040.cfg
Normal file
@@ -0,0 +1,29 @@
|
||||
#####################################################################
|
||||
# Find my instructions here:
|
||||
# https://github.com/bassamanator/rp2040-zero-adxl345-klipper
|
||||
# ADXL345 related Settings
|
||||
# https://www.klipper3d.org/Measuring_Resonances.html#adxl345
|
||||
#####################################################################
|
||||
|
||||
[mcu RP2040]
|
||||
baud: 115200 # 250000
|
||||
restart_method: command
|
||||
# Obtain definition by "ls -l /dev/serial/by-id/"
|
||||
serial: /dev/serial/by-id/usb-Klipper_rp2040_E6614C311B773B36-if00
|
||||
|
||||
[adxl345]
|
||||
cs_pin: RP2040:gpio1
|
||||
spi_bus: spi0a
|
||||
axes_map: x,z,y
|
||||
|
||||
[resonance_tester]
|
||||
accel_chip: adxl345
|
||||
probe_points: 111.5, 111.5, 20
|
||||
|
||||
[output_pin power_mode] # Improve power stability
|
||||
pin: RP2040:gpio23
|
||||
|
||||
[gcode_macro ADX]
|
||||
description: Shortcut to ACCELEROMETER_QUERY
|
||||
gcode:
|
||||
ACCELEROMETER_QUERY
|
||||
43
modules/services/printer/cfgs/adxl-rpi-pico-2x.cfg
Normal file
43
modules/services/printer/cfgs/adxl-rpi-pico-2x.cfg
Normal file
@@ -0,0 +1,43 @@
|
||||
#####################################################################
|
||||
# Config that supports a print head and a bed sensor at the same time
|
||||
# This requires a Raspberry Pi Pico.
|
||||
# Instructions: https://klipper.discourse.group/t/raspberry-pi-pico-adxl345-portable-resonance-measurement/1757/9
|
||||
# TLDR Instructions: The two sensors should use the spi0a (GPIO 0-3) and spi1a (GPIO 9-12) buses, respectively.
|
||||
#
|
||||
# Recommended mounts:
|
||||
# https://www.printables.com/model/385334-sovol-sv06-adxl345-mount-printhead-and-bed
|
||||
#
|
||||
# ADXL345 related Settings
|
||||
# https://www.klipper3d.org/Measuring_Resonances.html#adxl345
|
||||
#####################################################################
|
||||
|
||||
[mcu RP2040]
|
||||
baud: 115200
|
||||
restart_method: command
|
||||
# Obtain definition by "ls -l /dev/serial/by-id/"
|
||||
serial: /dev/serial/by-id/usb-Klipper_rp2040_E66138935F154C28-if00
|
||||
|
||||
[adxl345 head]
|
||||
cs_pin: RP2040:gpio1
|
||||
spi_bus: spi0a
|
||||
# update axes_map if your sensor is oriented differently. Note the print on your sensor.
|
||||
# -y, -z, x means that
|
||||
# - the x axis of your printer corresponds to the sensor's negative y axis
|
||||
# - the y axis of your printer corresponds to the sensor's negative z axis
|
||||
# - the z axis of your printer corresponds to the sensor's x axis
|
||||
axes_map: -y, -z, x
|
||||
|
||||
[adxl345 bed]
|
||||
cs_pin: RP2040:gpio9
|
||||
spi_bus: spi1a
|
||||
|
||||
[resonance_tester]
|
||||
accel_chip_x: adxl345 head
|
||||
accel_chip_y: adxl345 bed
|
||||
probe_points: 111.5, 111.5, 20
|
||||
|
||||
[gcode_macro ADX]
|
||||
description: Shortcut to ACCELEROMETER_QUERY for both sensors
|
||||
gcode:
|
||||
ACCELEROMETER_QUERY CHIP=head
|
||||
ACCELEROMETER_QUERY CHIP=bed
|
||||
120
modules/services/printer/cfgs/kamp/Adaptive_Meshing.cfg
Normal file
120
modules/services/printer/cfgs/kamp/Adaptive_Meshing.cfg
Normal file
@@ -0,0 +1,120 @@
|
||||
# # # Klipper Adaptive Meshing # # #
|
||||
|
||||
# Heads up! If you have any other BED_MESH_CALIBRATE macros defined elsewhere in your config, you will need to comment out / remove them for this to work. (Klicky/Euclid Probe)
|
||||
# You will also need to be sure that [exclude_object] is defined in printer.cfg, and your slicer is labeling objects.
|
||||
# This macro will parse information from objects in your gcode to define a min and max mesh area to probe, creating an adaptive mesh!
|
||||
# This macro will not increase probe_count values in your [bed_mesh] config. If you want richer meshes, be sure to increase probe_count. We recommend at least 5,5.
|
||||
|
||||
[gcode_macro BED_MESH_CALIBRATE]
|
||||
rename_existing: _BED_MESH_CALIBRATE
|
||||
gcode:
|
||||
|
||||
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points
|
||||
{% set bed_mesh_min = printer.configfile.settings.bed_mesh.mesh_min %} # Get bed mesh min from printer.cfg
|
||||
{% set bed_mesh_max = printer.configfile.settings.bed_mesh.mesh_max %} # Get bed mesh max from printer.cfg
|
||||
{% set probe_count = printer.configfile.settings.bed_mesh.probe_count %} # Get probe count from printer.cfg
|
||||
{% set kamp_settings = printer["gcode_macro _KAMP_Settings"] %} # Pull variables from _KAMP_Settings
|
||||
{% set verbose_enable = kamp_settings.verbose_enable | abs %} # Pull verbose setting from _KAMP_Settings
|
||||
{% set probe_dock_enable = kamp_settings.probe_dock_enable | abs %} # Pull probe dockable probe settings from _KAMP_Settings
|
||||
{% set attach_macro = kamp_settings.attach_macro | string %} # Pull attach probe command from _KAMP_Settings
|
||||
{% set detach_macro = kamp_settings.detach_macro | string %} # Pull detach probe command from _KAMP_Settings
|
||||
{% set mesh_margin = kamp_settings.mesh_margin | float %} # Pull mesh margin setting from _KAMP_Settings
|
||||
{% set fuzz_amount = kamp_settings.fuzz_amount | float %} # Pull fuzz amount setting from _KAMP_Settings
|
||||
{% set probe_count = probe_count if probe_count|length > 1 else probe_count * 2 %} # If probe count is only a single number, convert it to 2. E.g. probe_count:7 = 7,7
|
||||
{% set max_probe_point_distance_x = ( bed_mesh_max[0] - bed_mesh_min[0] ) / (probe_count[0] - 1) %} # Determine max probe point distance
|
||||
{% set max_probe_point_distance_y = ( bed_mesh_max[1] - bed_mesh_min[1] ) / (probe_count[1] - 1) %} # Determine max probe point distance
|
||||
{% set x_min = all_points | map(attribute=0) | min | default(bed_mesh_min[0]) %} # Set x_min from smallest object x point
|
||||
{% set y_min = all_points | map(attribute=1) | min | default(bed_mesh_min[1]) %} # Set y_min from smallest object y point
|
||||
{% set x_max = all_points | map(attribute=0) | max | default(bed_mesh_max[0]) %} # Set x_max from largest object x point
|
||||
{% set y_max = all_points | map(attribute=1) | max | default(bed_mesh_max[1]) %} # Set y_max from largest object y point
|
||||
|
||||
{% set fuzz_range = range((0) | int, (fuzz_amount * 100) | int + 1) %} # Set fuzz_range between 0 and fuzz_amount
|
||||
{% set adapted_x_min = x_min - mesh_margin - (fuzz_range | random / 100.0) %} # Adapt x_min to margin and fuzz constraints
|
||||
{% set adapted_y_min = y_min - mesh_margin - (fuzz_range | random / 100.0) %} # Adapt y_min to margin and fuzz constraints
|
||||
{% set adapted_x_max = x_max + mesh_margin + (fuzz_range | random / 100.0) %} # Adapt x_max to margin and fuzz constraints
|
||||
{% set adapted_y_max = y_max + mesh_margin + (fuzz_range | random / 100.0) %} # Adapt y_max to margin and fuzz constraints
|
||||
|
||||
{% set adapted_x_min = [adapted_x_min , bed_mesh_min[0]] | max %} # Compare adjustments to defaults and choose max
|
||||
{% set adapted_y_min = [adapted_y_min , bed_mesh_min[1]] | max %} # Compare adjustments to defaults and choose max
|
||||
{% set adapted_x_max = [adapted_x_max , bed_mesh_max[0]] | min %} # Compare adjustments to defaults and choose min
|
||||
{% set adapted_y_max = [adapted_y_max , bed_mesh_max[1]] | min %} # Compare adjustments to defaults and choose min
|
||||
|
||||
{% set points_x = (((adapted_x_max - adapted_x_min) / max_probe_point_distance_x) | round(method='ceil') | int) + 1 %} # Define probe_count's x point count and round up
|
||||
{% set points_y = (((adapted_y_max - adapted_y_min) / max_probe_point_distance_y) | round(method='ceil') | int) + 1 %} # Define probe_count's y point count and round up
|
||||
|
||||
{% if (([points_x, points_y]|max) > 6) %} #
|
||||
{% set algorithm = "bicubic" %} #
|
||||
{% set min_points = 4 %} #
|
||||
{% else %} # Calculate if algorithm should be bicubic or lagrange
|
||||
{% set algorithm = "lagrange" %} #
|
||||
{% set min_points = 3 %} #
|
||||
{% endif %} #
|
||||
|
||||
{% set points_x = [points_x , min_points]|max %} # Set probe_count's x points to fit the calculated algorithm
|
||||
{% set points_y = [points_y , min_points]|max %} # Set probe_count's y points to fit the calculated algorithm
|
||||
{% set points_x = [points_x , probe_count[0]]|min %}
|
||||
{% set points_y = [points_y , probe_count[1]]|min %}
|
||||
|
||||
{% if verbose_enable == True %} # If verbose is enabled, print information about KAMP's calculations
|
||||
{% if printer.exclude_object.objects != [] %}
|
||||
|
||||
{ action_respond_info( "Algorithm: {}.".format(
|
||||
(algorithm),
|
||||
)) }
|
||||
|
||||
{ action_respond_info("Default probe count: {},{}.".format(
|
||||
(probe_count[0]),
|
||||
(probe_count[1]),
|
||||
)) }
|
||||
|
||||
{ action_respond_info("Adapted probe count: {},{}.".format(
|
||||
(points_x),
|
||||
(points_y),
|
||||
)) }
|
||||
|
||||
{action_respond_info("Default mesh bounds: {}, {}.".format(
|
||||
(bed_mesh_min[0],bed_mesh_min[1]),
|
||||
(bed_mesh_max[0],bed_mesh_max[1]),
|
||||
)) }
|
||||
|
||||
{% if mesh_margin > 0 %}
|
||||
{action_respond_info("Mesh margin is {}, mesh bounds extended by {}mm.".format(
|
||||
(mesh_margin),
|
||||
(mesh_margin),
|
||||
)) }
|
||||
{% else %}
|
||||
{action_respond_info("Mesh margin is 0, margin not increased.")}
|
||||
{% endif %}
|
||||
|
||||
{% if fuzz_amount > 0 %}
|
||||
{action_respond_info("Mesh point fuzzing enabled, points fuzzed up to {}mm.".format(
|
||||
(fuzz_amount),
|
||||
)) }
|
||||
{% else %}
|
||||
{action_respond_info("Fuzz amount is 0, mesh points not fuzzed.")}
|
||||
{% endif %}
|
||||
|
||||
{ action_respond_info("Adapted mesh bounds: {}, {}.".format(
|
||||
(adapted_x_min, adapted_y_min),
|
||||
(adapted_x_max, adapted_y_max),
|
||||
)) }
|
||||
|
||||
{action_respond_info("KAMP adjustments successful. Happy KAMPing!")}
|
||||
|
||||
{% else %}
|
||||
|
||||
{action_respond_info("No objects detected! Check your gcode and make sure that EXCLUDE_OBJECT_DEFINE is happening before BED_MESH_CALIBRATE is called. Defaulting to regular meshing.")}
|
||||
G4 P5000 # Wait 5 seconds to make error more visible
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if probe_dock_enable == True %}
|
||||
{attach_macro} # Attach/deploy a probe if the probe is stored somewhere outside of the print area
|
||||
{% endif %}
|
||||
|
||||
_BED_MESH_CALIBRATE mesh_min={adapted_x_min},{adapted_y_min} mesh_max={adapted_x_max},{adapted_y_max} ALGORITHM={algorithm} PROBE_COUNT={points_x},{points_y}
|
||||
|
||||
{% if probe_dock_enable == True %}
|
||||
{detach_macro} # Detach/stow a probe if the probe is stored somewhere outside of the print area
|
||||
{% endif %} # End of verbose
|
||||
37
modules/services/printer/cfgs/kamp/KAMP_Settings.cfg
Normal file
37
modules/services/printer/cfgs/kamp/KAMP_Settings.cfg
Normal file
@@ -0,0 +1,37 @@
|
||||
# Below you can include specific configuration files depending on what you want KAMP to do:
|
||||
|
||||
# NOTE bassamanator: uncomment the functionality that you want to use from KAMP
|
||||
[include ./Adaptive_Meshing.cfg] # Include to enable adaptive meshing configuration.
|
||||
[include ./Line_Purge.cfg] # Include to enable adaptive line purging configuration.
|
||||
# [include ./Voron_Purge.cfg] # Include to enable adaptive Voron logo purging configuration.
|
||||
# [include ./Smart_Park.cfg] # Include to enable the Smart Park function, which parks the printhead near the print area for final heating.
|
||||
|
||||
[gcode_macro _KAMP_Settings]
|
||||
description: This macro contains all adjustable settings for KAMP
|
||||
|
||||
# The following variables are settings for KAMP as a whole.
|
||||
variable_verbose_enable: True # Set to True to enable KAMP information output when running. This is useful for debugging.
|
||||
|
||||
# The following variables are for adjusting adaptive mesh settings for KAMP.
|
||||
variable_mesh_margin: 0 # Expands the mesh size in millimeters if desired. Leave at 0 to disable.
|
||||
variable_fuzz_amount: 0 # Slightly randomizes mesh points to spread out wear from nozzle-based probes. Leave at 0 to disable.
|
||||
|
||||
# The following variables are for those with a dockable probe like Klicky, Euclid, etc. # ---------------- Attach Macro | Detach Macro
|
||||
variable_probe_dock_enable: False # Set to True to enable the usage of a dockable probe. # ---------------------------------------------
|
||||
variable_attach_macro: 'Attach_Probe' # The macro that is used to attach the probe. # Klicky Probe: 'Attach_Probe' | 'Dock_Probe'
|
||||
variable_detach_macro: 'Dock_Probe' # The macro that is used to store the probe. # Euclid Probe: 'Deploy_Probe' | 'Stow_Probe'
|
||||
# Legacy Gcode: 'M401' | 'M402'
|
||||
|
||||
# The following variables are for adjusting adaptive purge settings for KAMP.
|
||||
variable_purge_height: 0.8 # Z position of nozzle during purge, default is 0.8.
|
||||
variable_tip_distance: 0 # Distance between tip of filament and nozzle before purge. Should be similar to PRINT_END final retract amount.
|
||||
variable_purge_margin: 10 # Distance the purge will be in front of the print area, default is 10.
|
||||
variable_purge_amount: 30 # Amount of filament to be purged prior to printing.
|
||||
variable_flow_rate: 12 # Flow rate of purge in mm3/s. Default is 12.
|
||||
|
||||
# The following variables are for adjusting the Smart Park feature for KAMP, which will park the printhead near the print area at a specified height.
|
||||
variable_smart_park_height: 10 # Z position for Smart Park, default is 10.
|
||||
|
||||
gcode: # Gcode section left intentionally blank. Do not disturb.
|
||||
|
||||
{action_respond_info(" Running the KAMP_Settings macro does nothing, it is only used for storing KAMP settings. ")}
|
||||
119
modules/services/printer/cfgs/kamp/Line_Purge.cfg
Normal file
119
modules/services/printer/cfgs/kamp/Line_Purge.cfg
Normal file
@@ -0,0 +1,119 @@
|
||||
[gcode_macro LINE_PURGE]
|
||||
description: A purge macro that adapts to be near your actual printed objects
|
||||
gcode:
|
||||
# Get relevant printer params
|
||||
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %}
|
||||
{% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %}
|
||||
|
||||
# Use firmware retraction if it is defined
|
||||
{% if printer.firmware_retraction is defined %}
|
||||
{% set RETRACT = G10 | string %}
|
||||
{% set UNRETRACT = G11 | string %}
|
||||
{% else %}
|
||||
{% set RETRACT = 'G1 E-.5 F2100' | string %}
|
||||
{% set UNRETRACT = 'G1 E.5 F2100' | string %}
|
||||
{% endif %}
|
||||
|
||||
# Get purge settings from _Kamp_Settings
|
||||
{% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %}
|
||||
{% set purge_height = printer["gcode_macro _KAMP_Settings"].purge_height | float %}
|
||||
{% set tip_distance = printer["gcode_macro _KAMP_Settings"].tip_distance | float %}
|
||||
{% set purge_margin = printer["gcode_macro _KAMP_Settings"].purge_margin | float %}
|
||||
{% set purge_amount = printer["gcode_macro _KAMP_Settings"].purge_amount | float %}
|
||||
{% set flow_rate = printer["gcode_macro _KAMP_Settings"].flow_rate | float %}
|
||||
|
||||
|
||||
# Calculate purge origins and centers from objects
|
||||
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points
|
||||
{% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min
|
||||
{% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max
|
||||
{% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min
|
||||
{% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max
|
||||
|
||||
{% set purge_x_center = ([((purge_x_max + purge_x_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on X axis
|
||||
{% set purge_y_center = ([((purge_y_max + purge_y_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on Y axis
|
||||
|
||||
{% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger
|
||||
{% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger
|
||||
|
||||
# Calculate purge speed
|
||||
{% set purge_move_speed = (flow_rate / 5.0) * 60 | float %}
|
||||
|
||||
{% if cross_section < 5 %}
|
||||
|
||||
{action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% if verbose_enable == True %}
|
||||
|
||||
{action_respond_info("Moving filament tip {}mms".format(
|
||||
(tip_distance),
|
||||
)) }
|
||||
{% endif %}
|
||||
|
||||
{% if printer.firmware_retraction is defined %}
|
||||
{action_respond_info("KAMP purge is using firmware retraction.")}
|
||||
{% else %}
|
||||
{action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")}
|
||||
{% endif %}
|
||||
|
||||
{% if purge_y_origin > 0 %}
|
||||
|
||||
{action_respond_info("KAMP purge starting at {}, {} and purging {}mm of filament, requested flow rate is {}mm/s3.".format(
|
||||
(purge_x_center),
|
||||
(purge_y_origin),
|
||||
(purge_amount),
|
||||
(flow_rate),
|
||||
)) }
|
||||
|
||||
{% else %}
|
||||
|
||||
{action_respond_info("KAMP purge starting at {}, {} and purging {}mm of filament, requested flow rate is {}mm/s3.".format(
|
||||
(purge_x_origin),
|
||||
(purge_y_center),
|
||||
(purge_amount),
|
||||
(flow_rate),
|
||||
)) }
|
||||
|
||||
{% endif %}
|
||||
|
||||
SAVE_GCODE_STATE NAME=Prepurge_State # Create gcode state
|
||||
|
||||
{% if purge_y_origin > 0 %} # If there's room on Y, purge along X axis in front of print area
|
||||
|
||||
G92 E0 # Reset extruder
|
||||
G0 F{travel_speed} # Set travel speed
|
||||
G90 # Absolute positioning
|
||||
G0 X{purge_x_center} Y{purge_y_origin} # Move to purge position
|
||||
G0 Z{purge_height} # Move to purge Z height
|
||||
M83 # Relative extrusion mode
|
||||
G1 E{tip_distance} F{purge_move_speed} # Move filament tip
|
||||
G1 X{purge_x_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line
|
||||
{RETRACT} # Retract
|
||||
G0 X{purge_x_center + purge_amount + 10} F{travel_speed} # Rapid move to break string
|
||||
G92 E0 # Reset extruder distance
|
||||
M82 # Absolute extrusion mode
|
||||
G0 Z{purge_height * 2} F{travel_speed} # Z hop
|
||||
|
||||
{% else %} # If there's room on X, purge along Y axis to the left of print area
|
||||
|
||||
G92 E0 # Reset extruder
|
||||
G0 F{travel_speed} # Set travel speed
|
||||
G90 # Absolute positioning
|
||||
G0 X{purge_x_origin} Y{purge_y_center} # Move to purge position
|
||||
G0 Z{purge_height} # Move to purge Z height
|
||||
M83 # Relative extrusion mode
|
||||
G1 E{tip_distance} F{purge_move_speed} # Move filament tip
|
||||
G1 Y{purge_y_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line
|
||||
{RETRACT} # Retract
|
||||
G0 Y{purge_y_center + purge_amount + 10} F{travel_speed} # Rapid move to break string
|
||||
G92 E0 # Reset extruder distance
|
||||
M82 # Absolute extrusion mode
|
||||
G0 Z{purge_height * 2} F{travel_speed} # Z hop
|
||||
|
||||
{% endif %}
|
||||
|
||||
RESTORE_GCODE_STATE NAME=Prepurge_State # Restore gcode state
|
||||
|
||||
{% endif %}
|
||||
38
modules/services/printer/cfgs/kamp/Smart_Park.cfg
Normal file
38
modules/services/printer/cfgs/kamp/Smart_Park.cfg
Normal file
@@ -0,0 +1,38 @@
|
||||
[gcode_macro SMART_PARK]
|
||||
description: Parks your printhead near the print area for pre-print hotend heating.
|
||||
gcode:
|
||||
|
||||
{% set kamp_settings = printer["gcode_macro _KAMP_Settings"] %} # Pull all variables from _KAMP_Settings
|
||||
{% set z_height = kamp_settings.smart_park_height | float %} # Set Z height variable
|
||||
{% set purge_margin = kamp_settings.purge_margin | float %} # Set purge margin variable
|
||||
{% set verbose_enable = kamp_settings.verbose_enable | abs %} # Set verbosity
|
||||
{% set center_x = printer.toolhead.axis_maximum.x / 2 | float %} # Create center point of x for fallback
|
||||
{% set center_y = printer.toolhead.axis_maximum.y / 2 | float %} # Create center point of y for fallback
|
||||
{% set axis_minimum_x = printer.toolhead.axis_minimum.x | float %}
|
||||
{% set axis_minimum_y = printer.toolhead.axis_minimum.y | float %}
|
||||
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points
|
||||
{% set x_min = all_points | map(attribute=0) | min | default(center_x) %} # Set x_min from smallest object x point
|
||||
{% set y_min = all_points | map(attribute=1) | min | default(center_y) %} # Set y_min from smallest object y point
|
||||
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} # Set travel speed from config
|
||||
|
||||
{% if purge_margin > 0 and x_min != center_x and y_min != center_y %} # If objects are detected and purge margin
|
||||
{% set x_min = [ x_min - purge_margin , x_min ] | min %} # value is greater than 0, move
|
||||
{% set y_min = [ y_min - purge_margin , y_min ] | min %} # to purge location + margin
|
||||
{% set x_min = [ x_min , axis_minimum_x ] | max %}
|
||||
{% set y_min = [ y_min , axis_minimum_y ] | max %}
|
||||
{% endif %}
|
||||
|
||||
{% if verbose_enable == True %} # Verbose park location
|
||||
|
||||
{ action_respond_info("Smart Park location: {},{}.".format(
|
||||
(x_min),
|
||||
(y_min),
|
||||
)) }
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if printer.toolhead.position.z < z_height %}
|
||||
G0 Z{z_height} # Move Z to park height if current Z position is lower than z_height
|
||||
{% endif %}
|
||||
G0 X{x_min} Y{y_min} F{travel_speed} # Move near object area
|
||||
G0 Z{z_height} # Move Z to park height
|
||||
91
modules/services/printer/cfgs/kamp/Voron_Purge.cfg
Normal file
91
modules/services/printer/cfgs/kamp/Voron_Purge.cfg
Normal file
@@ -0,0 +1,91 @@
|
||||
[gcode_macro VORON_PURGE]
|
||||
description: A purge macro that adapts to be near your actual printed objects
|
||||
gcode:
|
||||
# Get relevant printer params
|
||||
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %}
|
||||
{% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %}
|
||||
|
||||
# Use firmware retraction if it is defined
|
||||
{% if printer.firmware_retraction is defined %}
|
||||
{% set RETRACT = G10 | string %}
|
||||
{% set UNRETRACT = G11 | string %}
|
||||
{% else %}
|
||||
{% set RETRACT = 'G1 E-.5 F2100' | string %}
|
||||
{% set UNRETRACT = 'G1 E.5 F2100' | string %}
|
||||
{% endif %}
|
||||
|
||||
# Get purge settings from _Kamp_Settings
|
||||
{% set kamp_settings = printer["gcode_macro _KAMP_Settings"] %}
|
||||
{% set verbose_enable = kamp_settings.verbose_enable | abs %}
|
||||
{% set purge_height = kamp_settings.purge_height | float %}
|
||||
{% set tip_distance = kamp_settings.tip_distance | float %}
|
||||
{% set purge_margin = kamp_settings.purge_margin | float %}
|
||||
{% set purge_amount = kamp_settings.purge_amount | float %}
|
||||
{% set flow_rate = kamp_settings.flow_rate | float %}
|
||||
{% set size = 10 | float %}
|
||||
|
||||
# Calculate purge origins and centers from objects
|
||||
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points
|
||||
{% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min
|
||||
{% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max
|
||||
{% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min
|
||||
{% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max
|
||||
|
||||
{% set purge_x_center = ([((purge_x_max + purge_x_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on X axis
|
||||
{% set purge_y_center = ([((purge_y_max + purge_y_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on Y axis
|
||||
|
||||
{% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger
|
||||
{% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger
|
||||
|
||||
# Calculate purge speed
|
||||
{% set purge_move_speed = (flow_rate / 5.0) * 60 | float %}
|
||||
|
||||
{% if cross_section < 5 %}
|
||||
|
||||
{action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% if verbose_enable == True %}
|
||||
|
||||
{action_respond_info("Moving filament tip {}mms".format(
|
||||
(tip_distance),
|
||||
)) }
|
||||
{% endif %}
|
||||
|
||||
{% if printer.firmware_retraction is defined %}
|
||||
{action_respond_info("KAMP purge is using firmware retraction.")}
|
||||
{% else %}
|
||||
{action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")}
|
||||
{% endif %}
|
||||
|
||||
SAVE_GCODE_STATE NAME=Prepurge_State # Create gcode state
|
||||
|
||||
G92 E0 # Reset extruder
|
||||
G0 F{travel_speed} # Set travel speed
|
||||
G90 # Absolute positioning
|
||||
G0 X{purge_x_origin} Y{purge_y_origin+size/2} # Move to purge position
|
||||
G0 Z{purge_height} # Move to purge Z height
|
||||
M83 # Relative extrusion mode
|
||||
G1 E{tip_distance} F{purge_move_speed} # Move tip of filament to nozzle
|
||||
G1 X{purge_x_origin+size*0.289} Y{purge_y_origin+size} E{purge_amount/4} F{purge_move_speed} # Purge first line of logo
|
||||
{RETRACT} # Retract
|
||||
G0 Z{purge_height*2} # Z hop
|
||||
G0 X{purge_x_origin+size*0.789} Y{purge_y_origin+size} # Move to second purge line origin
|
||||
G0 Z{purge_height} # Move to purge Z height
|
||||
{UNRETRACT} # Recover
|
||||
G1 X{purge_x_origin+size*0.211} Y{purge_y_origin} E{purge_amount/2} F{purge_move_speed} # Purge second line of logo
|
||||
{RETRACT} # Retract
|
||||
G0 Z{purge_height*2} # Z hop
|
||||
G0 X{purge_x_origin+size*0.711} Y{purge_y_origin} # Move to third purge line origin
|
||||
G0 Z{purge_height} # Move to purge Z height
|
||||
{UNRETRACT} # Recover
|
||||
G1 X{purge_x_origin+size} Y{purge_y_origin+size/2} E{purge_amount/4} F{purge_move_speed} # Purge third line of logo
|
||||
{RETRACT} # Retract
|
||||
G92 E0 # Reset extruder distance
|
||||
M82 # Absolute extrusion mode
|
||||
G0 Z{purge_height*2} F{travel_speed} # Z hop
|
||||
|
||||
RESTORE_GCODE_STATE NAME=Prepurge_State # Restore gcode state
|
||||
|
||||
{% endif %}
|
||||
330
modules/services/printer/cfgs/misc-macros.cfg
Normal file
330
modules/services/printer/cfgs/misc-macros.cfg
Normal file
@@ -0,0 +1,330 @@
|
||||
[force_move]
|
||||
enable_force_move: True
|
||||
|
||||
# NOTE If you're using a Raspberry Pi, you can uncomment the next 2 lines, optionally.
|
||||
[temperature_sensor raspberry_pi]
|
||||
sensor_type: temperature_host
|
||||
|
||||
# NOTE If you're using a an Orange Pi, you can uncomment the next 3 lines, optionally.
|
||||
# [temperature_sensor Orange_Pi]
|
||||
# sensor_type: temperature_host
|
||||
# sensor_path: /sys/class/thermal/thermal_zone0/temp
|
||||
|
||||
[virtual_sdcard]
|
||||
path: /home/pi/printer_data/gcodes
|
||||
|
||||
# NOTE Cancel objects feature is enabled. If you're using a low powered device, comment out [exclude_object].
|
||||
# Also see [file_manager] section in moonraker.conf.
|
||||
[exclude_object]
|
||||
|
||||
[pause_resume]
|
||||
[display_status]
|
||||
|
||||
[delayed_gcode DISABLEFILAMENTSENSOR]
|
||||
initial_duration: 1
|
||||
gcode:
|
||||
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
|
||||
|
||||
[gcode_macro _globals]
|
||||
variable_filament_sensor_enabled: 1 # NOTE Enable(1) or disable(0) the filament sensor, if one is connected
|
||||
variable_beeping_enabled: 1 # NOTE Enable(1) or disable(0) beeping everywhere except during gantry calibration
|
||||
variable_bed_temp_over: 10 # NOTE Start print if bed temperature is over by this amount, otherwise wait for temperature drop
|
||||
variable_kamp_enable: 1 # NOTE Enable(1) or disable(0) KAMP (adaptive mesh)
|
||||
variable_pre_purge_prime_length: 1.40
|
||||
gcode:
|
||||
# Don't delete this section
|
||||
|
||||
[gcode_macro CONDITIONAL_BEEP]
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set i = params.I|default(1)|int %} ; Iterations (number of times to beep).
|
||||
{% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms.
|
||||
{% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz.
|
||||
|
||||
{% set BEEPING_ENABLED=printer["gcode_macro _globals"].beeping_enabled|default(-1)|int %}
|
||||
|
||||
{% if BEEPING_ENABLED == 1 %}
|
||||
BEEP I={i} DUR={dur} FREQ={freq}
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro ADJUST_FILAMENT_SENSOR_STATUS]
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set NEWSTATUS = params.ENABLE|default(-1)|int %}
|
||||
|
||||
{% set FILAMENT_SENSOR_ENABLED=printer["gcode_macro _globals"].filament_sensor_enabled|default(-1)|int %}
|
||||
|
||||
{% if FILAMENT_SENSOR_ENABLED == 1 and NEWSTATUS != -1 %}
|
||||
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE={NEWSTATUS}
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro M109]
|
||||
rename_existing: M99109
|
||||
gcode:
|
||||
#Parameters
|
||||
{% set s = params.S|float %}
|
||||
|
||||
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set hotend temp
|
||||
{% if s != 0 %}
|
||||
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1} ; Wait for hotend temp (within 1 degree)
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro M190]
|
||||
rename_existing: M99190
|
||||
gcode:
|
||||
#Parameters
|
||||
{% set s = params.S|float %}
|
||||
|
||||
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set bed temp
|
||||
{% if s != 0 %}
|
||||
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+1} ; Wait for bed temp (within 1 degree)
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro PURGE_LINE]
|
||||
gcode:
|
||||
{% set PRE_PURGE_PRIME_LENGTH=printer["gcode_macro _globals"].pre_purge_prime_length|default(1.40)|float %}
|
||||
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=1
|
||||
|
||||
# Misc variables
|
||||
{% set extrudeAmount = 26.6 %}
|
||||
{% set movementLength = 100.0 %}
|
||||
{% set movementSpeed = 15 * 60 %}
|
||||
{% set xStart = 0.5 %}
|
||||
{% set yStart = 0.5 %}
|
||||
|
||||
# Set safe speeds
|
||||
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
|
||||
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
|
||||
|
||||
G92 E0.0 ; reset extruder
|
||||
G90 ; Absolute positioning
|
||||
G0 X{xStart} Y{yStart} F{maxVelocityAdjusted} ; move to purge position
|
||||
G1 Z0.4 F500.0 ; move to purge height
|
||||
M83 ; Relative extrusion mode
|
||||
G1 E{PRE_PURGE_PRIME_LENGTH} F500 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT
|
||||
G1 X{xStart + movementLength} E{extrudeAmount} F{movementSpeed} ; intro line 1
|
||||
|
||||
G92 E0.0 ; reset extruder
|
||||
M82 ; Absolute extrusion mode
|
||||
G1 Z5.0 ; move nozzle to prevent scratch
|
||||
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
rename_existing: BASE_CANCEL_PRINT
|
||||
gcode:
|
||||
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
|
||||
CLEAR_PAUSE
|
||||
SDCARD_RESET_FILE
|
||||
PRINT_END
|
||||
BASE_CANCEL_PRINT
|
||||
|
||||
[gcode_macro PRINT_START]
|
||||
gcode:
|
||||
|
||||
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=1
|
||||
# Parameters
|
||||
{% set bedtemp = params.BED|int %}
|
||||
{% set hotendtemp = params.HOTEND|int %}
|
||||
{% set chambertemp = params.CHAMBER|default(0)|int %}
|
||||
|
||||
# Other variables
|
||||
{% set bedtempSlicer = bedtemp %}
|
||||
{% set bedtempOver = printer["gcode_macro _globals"].bed_temp_over|default(0)|int %}
|
||||
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
|
||||
{% set maxVelocityAdjusted = (0.90 * maxVelocity * 60)|int %}
|
||||
{% set kampEnabled=printer["gcode_macro _globals"].kamp_enable|default(0)|int %}
|
||||
|
||||
{% if printer.configfile.settings.safe_z_home %}
|
||||
{% set startX = printer.configfile.settings.safe_z_home.home_xy_position[0]|float %}
|
||||
{% set startY = printer.configfile.settings.safe_z_home.home_xy_position[1]|float %}
|
||||
{% endif %}
|
||||
|
||||
{% set bedtempAlmost = ((bedtemp - 2, 0, printer.heater_bed.temperature|int)|max, bedtemp)|max %}
|
||||
{% set hotendtempStepOne = ((hotendtemp, printer[printer.toolhead.extruder].temperature|int)|min, 150)|max %}
|
||||
{% set hotendtempStepTwo = ((hotendtemp, printer[printer.toolhead.extruder].temperature|int)|min, 170)|max %}
|
||||
|
||||
# If bed-temp-almost is higher than bed-temp by a maximum of bed-temp-over
|
||||
{% if bedtempAlmost > bedtemp %}
|
||||
{% if (bedtempAlmost - bedtempOver) <= bedtemp %}
|
||||
{% set bedtemp = bedtempAlmost %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
G90 ; absolute positioning
|
||||
M140 S{bedtempAlmost} ; set & don't wait for bed temp
|
||||
M104 S{hotendtempStepOne} ; set & don't wait for hotend temp
|
||||
G28 X Y
|
||||
{% if printer.configfile.settings.safe_z_home %}
|
||||
G1 X{startX} Y{startY} F{maxVelocityAdjusted}
|
||||
{% endif %}
|
||||
|
||||
M190 S{bedtempAlmost} ; set & wait for bed temp
|
||||
{% if kampEnabled == 0 %}
|
||||
M104 S{hotendtempStepTwo} ; set & don't wait for hotend temp
|
||||
{% endif %}
|
||||
M190 S{bedtemp} ; set & wait for bed temp
|
||||
M140 S{bedtempSlicer} ; set & don't wait for bed temp ; set temp to sliced setting regardless
|
||||
|
||||
{% if kampEnabled == 0 %}
|
||||
BED_MESH_PROFILE LOAD=default ; NOTE if not using a mesh, comment out this line
|
||||
SKEW_PROFILE LOAD=CaliFlower
|
||||
M104 S{hotendtemp} ; set & don't wait for hotend temp
|
||||
G28 Z ; final z homing
|
||||
{% else %}
|
||||
G28 Z ; final z homing
|
||||
BED_MESH_CALIBRATE ; KAMP mesh
|
||||
M104 S{hotendtemp} ; set & don't wait for hotend temp
|
||||
{% endif %}
|
||||
|
||||
G1 X0 Y0 F{maxVelocityAdjusted}
|
||||
M109 S{hotendtemp} ; set & wait for hotend temp
|
||||
|
||||
G1 Z20 F3000 ; move nozzle away from bed
|
||||
|
||||
[gcode_macro PRINT_END]
|
||||
gcode:
|
||||
SET_SKEW CLEAR=1
|
||||
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=0
|
||||
CONDITIONAL_BEEP I=2 DUR=30 FREQ=8500
|
||||
{% set PRE_PURGE_PRIME_LENGTH=printer["gcode_macro _globals"].pre_purge_prime_length|default(1.40)|float %}
|
||||
|
||||
M400 ; wait for buffer to clear
|
||||
G92 E0 ; zero the extruder
|
||||
G1 E-{PRE_PURGE_PRIME_LENGTH} F400 ; retract filament
|
||||
G91 ; relative positioning
|
||||
|
||||
# Set safe speeds
|
||||
{% set zVelocity = printer.configfile.settings.printer.max_z_velocity|default(15)|int %}
|
||||
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
|
||||
{% set zVelocityAdjusted = (0.95 * zVelocity * 60)|int %}
|
||||
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
|
||||
|
||||
# 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 direction to move
|
||||
{% 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 %}
|
||||
|
||||
{% set lift_height = 25.0 %}
|
||||
{% if printer.toolhead.position.z < (max_z - lift_height) %}
|
||||
{% set z_safe = lift_height %}
|
||||
{% else %}
|
||||
{% set z_safe = max_z - printer.toolhead.position.z %}
|
||||
{% endif %}
|
||||
|
||||
G0 Z{z_safe} F{zVelocityAdjusted} ; move nozzle up
|
||||
G0 X{x_safe} Y{y_safe} F{maxVelocityAdjusted} ; move nozzle to remove stringing
|
||||
TURN_OFF_HEATERS
|
||||
M107 ; turn off fan
|
||||
G90 ; absolute positioning
|
||||
G0 X60 Y{max_y} F3600 ; park nozzle at rear
|
||||
M84
|
||||
|
||||
[gcode_macro LOAD_FILAMENT]
|
||||
gcode:
|
||||
M83 ; set extruder to relative
|
||||
G1 E30 F300 ; load
|
||||
G1 E15 F150 ; prime nozzle with filament
|
||||
M82 ; set extruder to absolute
|
||||
|
||||
[gcode_macro UNLOAD_FILAMENT]
|
||||
gcode:
|
||||
M83 ; set extruder to relative
|
||||
G1 E10 F300 ; extrude a little to soften tip
|
||||
G1 E-40 F1800 ; retract some, but not too much or it will jam
|
||||
M82 ; set extruder to absolute
|
||||
|
||||
[gcode_macro M600]
|
||||
gcode:
|
||||
CONDITIONAL_BEEP i=1 dur=300
|
||||
CONDITIONAL_BEEP i=1 dur=100
|
||||
CONDITIONAL_BEEP i=1 dur=100
|
||||
PAUSE ; Pause
|
||||
|
||||
[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
|
||||
|
||||
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=0
|
||||
|
||||
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 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 %}
|
||||
ADJUST_FILAMENT_SENSOR_STATUS ENABLE=1
|
||||
|
||||
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 %}
|
||||
|
||||
[gcode_macro _CG28]
|
||||
# Conditional homing
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro BEEP]
|
||||
description: BEEP I=3 DUR=200 FREQ=2000: Beep 3 times, for 200ms each, at 2kHz frequency.
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set i = params.I|default(1)|int %} ; Iterations (number of times to beep).
|
||||
{% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms.
|
||||
{% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz.
|
||||
|
||||
{% for iteration in range(i|int) %}
|
||||
SET_PIN PIN=beeper VALUE=0.8 CYCLE_TIME={ 1.0/freq if freq > 0 else 1 }
|
||||
G4 P{dur}
|
||||
SET_PIN PIN=beeper VALUE=0
|
||||
G4 P{dur}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user