Skip to content

Commit 16a0d15

Browse files
authored
Merge pull request #105 from kyleisah/voron-logo-purge
Voron logo purge and Smart Park feature added
2 parents 991a4e1 + 2e54f3f commit 16a0d15

File tree

5 files changed

+125
-6
lines changed

5 files changed

+125
-6
lines changed

Configuration/KAMP_Settings.cfg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# [include ./KAMP/Adaptive_Meshing.cfg] # Include to enable adaptive meshing configuration.
44
# [include ./KAMP/Line_Purge.cfg] # Include to enable adaptive line purging configuration.
5+
# [include ./KAMP/Voron_Purge.cfg] # Include to enable adaptive Voron logo purging configuration.
6+
# [include ./KAMP/Smart_Park.cfg] # Include to enable the Smart Park function, which parks the printhead near the print area for final heating.
57

68
[gcode_macro _KAMP_Settings]
79
description: This macro contains all adjustable settings for KAMP
@@ -26,6 +28,9 @@ variable_purge_margin: 10 # Distance the purge will be in fron
2628
variable_purge_amount: 30 # Amount of filament to be purged prior to printing.
2729
variable_flow_rate: 12 # Flow rate of purge in mm3/s. Default is 12.
2830

31+
# 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.
32+
variable_smart_park_height: 10 # Z position for Smart Park, default is 10.
33+
2934
gcode: # Gcode section left intentionally blank. Do not disturb.
3035

31-
{action_respond_info(" Running the KAMP_Settings macro does nothing, it is only used for storing KAMP settings. ")}
36+
{action_respond_info(" Running the KAMP_Settings macro does nothing, it is only used for storing KAMP settings. ")}

Configuration/Line_Purge.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ gcode:
3737
{% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger
3838

3939
# Calculate purge speed
40-
{% set purge_move_speed = (flow_rate / cross_section) * 60 | float %}
40+
{% set purge_move_speed = (flow_rate / 5.0) * 60 | float %}
4141

42-
{% if cross_section != 5 %}
42+
{% if cross_section < 5 %}
4343

44-
{action_respond_info("[Extruder] max_extrude_cross_section is not configured correctly, please set it to 5. Purge skipped.")}
44+
{action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")}
4545

4646
{% else %}
4747

@@ -110,4 +110,4 @@ gcode:
110110

111111
{% endif %}
112112

113-
{% endif %}
113+
{% endif %}

Configuration/Smart_Park.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[gcode_macro Smart_Park]
2+
description: Parks your printhead near the print area for pre-print hotend heating.
3+
gcode:
4+
5+
{% set z_height = printer["gcode_macro _KAMP_Settings"].smart_park_height | float %} # Pull park height value from _KAMP_Settings
6+
{% set center_x = printer.toolhead.axis_maximum.x / 2 | float %} # Create center point of x for fallback
7+
{% set center_y = printer.toolhead.axis_maximum.y / 2 | float %} # Create center point of y for fallback
8+
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points
9+
{% set x_min = all_points | map(attribute=0) | min | default(center_x) %} # Set x_min from smallest object x point
10+
{% set y_min = all_points | map(attribute=1) | min | default(center_y) %} # Set y_min from smallest object y point
11+
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} # Set travel speed from config
12+
13+
G0 X{x_min} Y{y_min} F{travel_speed} # Move near object area
14+
G0 Z{z_height} # Move Z to park height

Configuration/Voron_Purge.cfg

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[gcode_macro VORON_PURGE]
2+
description: A purge macro that adapts to be near your actual printed objects
3+
gcode:
4+
# Get relevant printer params
5+
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %}
6+
{% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %}
7+
8+
# Use firmware retraction if it is defined
9+
{% if printer.firmware_retraction is defined %}
10+
{% set RETRACT = G10 | string %}
11+
{% set UNRETRACT = G11 | string %}
12+
{% else %}
13+
{% set RETRACT = 'G1 E-.5 F2100' | string %}
14+
{% set UNRETRACT = 'G1 E.5 F2100' | string %}
15+
{% endif %}
16+
17+
# Get purge settings from _Kamp_Settings
18+
{% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %}
19+
{% set purge_height = printer["gcode_macro _KAMP_Settings"].purge_height | float %}
20+
{% set tip_distance = printer["gcode_macro _KAMP_Settings"].tip_distance | float %}
21+
{% set purge_margin = printer["gcode_macro _KAMP_Settings"].purge_margin | float %}
22+
{% set purge_amount = printer["gcode_macro _KAMP_Settings"].purge_amount | float %}
23+
{% set flow_rate = printer["gcode_macro _KAMP_Settings"].flow_rate | float %}
24+
{% set size = 10 | float %}
25+
26+
# Calculate purge origins and centers from objects
27+
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points
28+
{% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min
29+
{% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max
30+
{% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min
31+
{% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max
32+
33+
{% 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
34+
{% 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
35+
36+
{% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger
37+
{% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger
38+
39+
# Calculate purge speed
40+
{% set purge_move_speed = (flow_rate / 5.0) * 60 | float %}
41+
42+
{% if cross_section < 5 %}
43+
44+
{action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")}
45+
46+
{% else %}
47+
48+
{% if verbose_enable == True %}
49+
50+
{action_respond_info("Moving filament tip {}mms".format(
51+
(tip_distance),
52+
)) }
53+
{% endif %}
54+
55+
{% if printer.firmware_retraction is defined %}
56+
{action_respond_info("KAMP purge is using firmware retraction.")}
57+
{% else %}
58+
{action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")}
59+
{% endif %}
60+
61+
G92 E0 # Reset extruder
62+
G0 F{travel_speed} # Set travel speed
63+
G90 # Absolute positioning
64+
G0 X{purge_x_origin} Y{purge_y_origin+size/2} # Move to purge position
65+
G0 Z{purge_height} # Move to purge Z height
66+
M83 # Relative extrusion mode
67+
G1 E{tip_distance} F{purge_move_speed} # Move tip of filament to nozzle
68+
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
69+
G1 E-.5 F2100 # Retract
70+
G0 Z{purge_height*2} # Z hop
71+
G0 X{purge_x_origin+size*0.789} Y{purge_y_origin+size} # Move to second purge line origin
72+
G0 Z{purge_height} # Move to purge Z height
73+
G1 E.5 F2100 # Recover
74+
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
75+
G1 E-.5 F2100 # Retract
76+
G0 Z{purge_height*2} # Z hop
77+
G0 X{purge_x_origin+size*0.711} Y{purge_y_origin} # Move to third purge line origin
78+
G0 Z{purge_height} # Move to purge Z height
79+
G1 E.5 F2100 # Recover
80+
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
81+
G1 E-.5 F2100 # Retract
82+
G92 E0 # Reset extruder distance
83+
M82 # Absolute extrusion mode
84+
G0 Z{purge_height*2} F{travel_speed}
85+
86+
{% endif %}

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,18 @@ The cleanest and easiest way to get started with KAMP is to use Moonraker's Upda
128128
# This file enables the use of adaptive line purging.
129129
130130
[include ./KAMP/Line_Purge.cfg]
131+
132+
# This file enables the use of the adaptive Voron logo purge.
133+
134+
[include ./KAMP/Voron_Purge.cfg]
135+
136+
# This file enables the use of KAMP's Smart Park feature.
137+
138+
[include ./KAMP/Smart_Park.cfg]
131139
```
132140

133141
>**Note:**
134-
The KAMP configuration files are broken up like this to allow those who do not use bed probes to benefit from adaptive purging.
142+
The KAMP configuration files are broken up like this to allow those who do not use bed probes to benefit from adaptive purging, and other features.
135143

136144
4. After you `[include]` the features you want, be sure to restart your firmware so those inclusions take effect.
137145

@@ -192,6 +200,12 @@ The cleanest and easiest way to get started with KAMP is to use Moonraker's Upda
192200
>**Note:**
193201
It is required to add `max_extrude_cross_section: 5` to your `[extruder]` config to allow effective purging to be possible. KAMP will warn you if you forget to set this value, and skip the purge so the printer will not be halted. It is also recommended to set up [firmware_retraction](https://www.klipper3d.org/Config_Reference.html?h=retract#firmware_retraction) inside of klipper so KAMP can use the correct retration settings for your machine. If this is not found, KAMP will warn you, and use reasonable direct-drive extruder values to complete the purge.
194202

203+
## Smart Park:
204+
205+
* These settings are used for adjusting KAMP's Smart Park function, which is helpful to move the printhead near the print area to do your final heating.
206+
207+
* `smart_park_height:` This is the height at which you'd like your printhead to be when calling the `Smart_Park` macro. **Don't forget to add this near the end of your `Print_Start` macro, *before* the final heating command is called.**
208+
195209
## Troubleshooting:
196210
*
197211

0 commit comments

Comments
 (0)