Skip to content

Commit 7399a37

Browse files
authored
Minor fixes (#160)
* Update Line_Purge.cfg - Added 10mm rapid move at the end of the purge line to break any stringing and move nozzle to less likely area to collide with purged line. - Added gcode state save and restore to finally fix issues with slicer profiles that do not use relative extrusion mode. * Update Voron_Purge.cfg - Added gcode state save and restore to finally fix issues with slicer profiles that do not use relative extrusion mode. * Update Smart_Park.cfg Update smart park to account for purge margin if it is present, and if there are objects detected. * Update Smart_Park.cfg Sometimes with a full buildplate, the park will fail. Smart park will now compare the purge+margin point with the minimum point of the printed area and choose the bigger of the two points. * Update Adaptive_Meshing.cfg If KAMP adjustments exceed printer configured default bounds, remove adjustments and verbose message * fix spelling error for moonraker.conf * fix for calculated mesh exceeding bounds * fix readme, add common issue to troubleshooting
1 parent 23bee5b commit 7399a37

File tree

5 files changed

+53
-10
lines changed

5 files changed

+53
-10
lines changed

Configuration/Adaptive_Meshing.cfg

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ gcode:
3333
{% set adapted_x_max = (bed_mesh_max[0] - fuzz_amount + mesh_margin, x_max) | min + (fuzz_range | random / 100.0) %} # Adapt x_max to margin and fuzz constraints
3434
{% set adapted_y_max = (bed_mesh_max[1] - fuzz_amount + mesh_margin, y_max) | min + (fuzz_range | random / 100.0) %} # Adapt y_max to margin and fuzz constraints
3535

36+
{% set adapted_x_min = [adapted_x_min , bed_mesh_min[0]] | max %} # Compare adjustments to defaults and choose max
37+
{% set adapted_y_min = [adapted_y_min , bed_mesh_min[1]] | max %} # Compare adjustments to defaults and choose max
38+
{% set adapted_x_max = [adapted_x_max , bed_mesh_max[0]] | min %} # Compare adjustments to defaults and choose min
39+
{% set adapted_y_max = [adapted_y_max , bed_mesh_max[1]] | min %} # Compare adjustments to defaults and choose min
40+
3641
{% 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
3742
{% 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
3843

@@ -44,10 +49,10 @@ gcode:
4449
{% set min_points = 3 %} #
4550
{% endif %} #
4651

47-
{% set points_x = [points_x, min_points]|max %} # Set probe_count's x points to fit the calculated algorithm
48-
{% set points_y = [points_y, min_points]|max %} # Set probe_count's y points to fit the calculated algorithm
49-
{% set points_x = [points_x, probe_count[0]]|min %}
50-
{% set points_y = [points_y, probe_count[1]]|min %}
52+
{% set points_x = [points_x , min_points]|max %} # Set probe_count's x points to fit the calculated algorithm
53+
{% set points_y = [points_y , min_points]|max %} # Set probe_count's y points to fit the calculated algorithm
54+
{% set points_x = [points_x , probe_count[0]]|min %}
55+
{% set points_y = [points_y , probe_count[1]]|min %}
5156

5257
{% if verbose_enable == True %} # If verbose is enabled, print information about KAMP's calculations
5358

Configuration/Line_Purge.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ gcode:
7878

7979
{% endif %}
8080

81+
SAVE_GCODE_STATE NAME=Prepurge_State # Create gcode state
82+
8183
{% if purge_y_origin > 0 %} # If there's room on Y, purge along X axis in front of print area
8284

8385
G92 E0 # Reset extruder
@@ -89,6 +91,7 @@ gcode:
8991
G1 E{tip_distance} F{purge_move_speed} # Move filament tip
9092
G1 X{purge_x_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line
9193
{RETRACT} # Retract
94+
G0 X{purge_x_center + purge_amount + 10} F{travel_speed} # Rapid move to break string
9295
G92 E0 # Reset extruder distance
9396
M82 # Absolute extrusion mode
9497
G0 Z{purge_height * 2} F{travel_speed} # Z hop
@@ -104,10 +107,13 @@ gcode:
104107
G1 E{tip_distance} F{purge_move_speed} # Move filament tip
105108
G1 Y{purge_y_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line
106109
{RETRACT} # Retract
110+
G0 Y{purge_y_center + purge_amount + 10} F{travel_speed} # Rapid move to break string
107111
G92 E0 # Reset extruder distance
108112
M82 # Absolute extrusion mode
109113
G0 Z{purge_height * 2} F{travel_speed} # Z hop
110114

111115
{% endif %}
116+
117+
RESTORE_GCODE_STATE NAME=Prepurge_State # Restore gcode state
112118

113119
{% endif %}

Configuration/Smart_Park.cfg

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22
description: Parks your printhead near the print area for pre-print hotend heating.
33
gcode:
44

5-
{% set z_height = printer["gcode_macro _KAMP_Settings"].smart_park_height | float %} # Pull park height value from _KAMP_Settings
5+
{% set kamp_settings = printer["gcode_macro _KAMP_Settings"] %} # Pull all variables from _KAMP_Settings
6+
{% set z_height = kamp_settings.smart_park_height | float %} # Set Z height variable
7+
{% set purge_margin = kamp_settings.purge_margin | float %} # Set purge margin variable
8+
{% set verbose_enable = kamp_settings.verbose_enable | abs %} # Set verbosity
69
{% set center_x = printer.toolhead.axis_maximum.x / 2 | float %} # Create center point of x for fallback
710
{% set center_y = printer.toolhead.axis_maximum.y / 2 | float %} # Create center point of y for fallback
811
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points
912
{% set x_min = all_points | map(attribute=0) | min | default(center_x) %} # Set x_min from smallest object x point
1013
{% set y_min = all_points | map(attribute=1) | min | default(center_y) %} # Set y_min from smallest object y point
1114
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} # Set travel speed from config
1215

16+
{% if purge_margin > 0 and x_min != center_x and y_min != center_y %} # If objects are detected and purge margin
17+
{% set x_min = [ x_min - purge_margin , x_min ] | max %} # value is greater than 0, move
18+
{% set y_min = [ y_min - purge_margin , y_min ] | max %} # to purge location + margin
19+
{% endif %}
20+
21+
# Verbose park location
22+
{% if verbose_enable == True %}
23+
24+
{ action_respond_info("Smart Park location: {},{}.".format(
25+
(x_min),
26+
(y_min),
27+
)) }
28+
29+
{% endif %}
30+
1331
G0 X{x_min} Y{y_min} F{travel_speed} # Move near object area
14-
G0 Z{z_height} # Move Z to park height
32+
G0 Z{z_height} # Move Z to park height

Configuration/Voron_Purge.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ gcode:
5858
{action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")}
5959
{% endif %}
6060

61+
SAVE_GCODE_STATE NAME=Prepurge_State # Create gcode state
62+
6163
G92 E0 # Reset extruder
6264
G0 F{travel_speed} # Set travel speed
6365
G90 # Absolute positioning
@@ -81,6 +83,8 @@ gcode:
8183
G1 E-.5 F2100 # Retract
8284
G92 E0 # Reset extruder distance
8385
M82 # Absolute extrusion mode
84-
G0 Z{purge_height*2} F{travel_speed}
86+
G0 Z{purge_height*2} F{travel_speed} # Z hop
87+
88+
RESTORE_GCODE_STATE NAME=Prepurge_State # Restore gcode state
8589

8690
{% endif %}

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ The cleanest and easiest way to get started with KAMP is to use Moonraker's Upda
9898
>
9999
> It is also possible that with older setups of klipper or moonraker that your config path will be different. Be sure to use the correct config path for your machine when making the symbolic link, and when copying `KAMP_Settings.cfg` to your config directory.
100100

101-
2. Open your `moonraker.cfg` file and add this configuration:
101+
2. Open your `moonraker.conf` file and add this configuration:
102102
```yaml
103-
[update_manager Klipper-Adaptive-Meshing-Purging]
103+
[update_manager Klipper-Adaptive-Meshing-Purging]
104104
type: git_repo
105105
channel: dev
106106
path: ~/Klipper-Adaptive-Meshing-Purging
@@ -207,7 +207,17 @@ It is required to add `max_extrude_cross_section: 5` to your `[extruder]` config
207207
* `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 `Smart_Park` near the end of your `Print_Start` macro, *before* the final heating command is called.**
208208

209209
## Troubleshooting:
210-
*
210+
211+
<details>
212+
<summary>
213+
<b>
214+
I'm getting 'gcode_macro BED_MESH_CALIBRATE:gcode': TypeError: bad operand type for abs(): 'Undefined'
215+
</b>
216+
</summary>
217+
<p>
218+
</p>
219+
This was likely caused by you commenting out a setting in KAMP_Settings.cfg rather than just setting it to false. These checks needs to be in place, so instead of commenting them out, just set them to disabled.
220+
</details>
211221

212222
## Credits:
213223

0 commit comments

Comments
 (0)