Skip to content

Commit

Permalink
bed_mesh: Fix adaptive probe count on delta printers (#6600) (#254)
Browse files Browse the repository at this point in the history
Round beds require an odd number of probe points in
order to prevent erroneously truncating the mesh.

The adaptive mesh algorithm did not consider that and
as a result, it was possible to generate adaptive
meshes with even number of probe points.

This change fixes this by increasing the probe point
count by 1 in cases where the adaptive probe points
are even.

Signed-off-by: Mitko Haralanov <[email protected]>
Co-authored-by: voidtrance <[email protected]>
  • Loading branch information
rogerlz and voidtrance authored May 16, 2024
1 parent 886f4d5 commit 5d67b81
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions klippy/extras/bed_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,12 @@ def set_adaptive_mesh(self, gcmd):
self.origin = adapted_origin
self.mesh_min = (-self.radius, -self.radius)
self.mesh_max = (self.radius, self.radius)
self.mesh_config["x_count"] = self.mesh_config["y_count"] = max(
new_x_probe_count, new_y_probe_count
)
new_probe_count = max(new_x_probe_count, new_y_probe_count)
# Adaptive meshes require odd number of points
new_probe_count += 1 - (new_probe_count % 2)
self.mesh_config["x_count"] = self.mesh_config[
"y_count"
] = new_probe_count
else:
self.mesh_min = adjusted_mesh_min
self.mesh_max = adjusted_mesh_max
Expand Down

0 comments on commit 5d67b81

Please sign in to comment.