bed_mesh: Add Wandering Probe Points (WPP) dynamic offset#7277
Conversation
Signed-off-by: Hwang Younsang <famtory@gmail.com>
Signed-off-by: Hwang Younsang <famtory@gmail.com>
|
Which probes are you thinking about? 3D/BL touch don't cause any real wear, just like klicky and similar. Do you have concrete examples of wear caused by probing? Also, assuming someone will review the proposal, at some point you will have to sign with your real name and surname, I don't think Famtory is. |
|
Hi @dewi-ny-je, thanks for the review! Regarding the signature, you are absolutely right. The git commits themselves are already correctly signed off with my legal real name ( Regarding the concrete examples of wear: When using high-temperature materials like ABS or PC, even a wiped nozzle can leave microscopic filament residue (ooze). Repeated probing on the exact same micro-spot over dozens of prints causes this residue to accumulate, eventually shifting the Z-offset reading and causing leveling errors. Furthermore, a hot nozzle repeatedly tapping the exact same coordinate on a textured PEI sheet will eventually create a micro-divot and degrade the PEI coating at those specific points. Wandering the grid by a small step distributes this nozzle-tap wear evenly and avoids accumulated ooze points, significantly prolonging the lifespan of the build plate for nozzle-probing users without altering the mesh math. Let me know if you need any further clarifications! |
|
Thanks for the clarification! I had forgotten about those probing techniques. Indeed a useful feature. Hopefully a reviewer will pick it up. |
|
@dewi-ny-je To be honest, I'm not very active in communities like Discord, so I just submitted it here as a start. But I really appreciate the great advice! I'll see if I can share it around. Thanks again! |
|
Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html There are some steps that you can take now:
Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available. Best regards, PS: I'm just an automated script, not a human being. |
|
Has this feature the green light by @KevinOConnor assuming it is properly reviewed? |
dewi-ny-je
left a comment
There was a problem hiding this comment.
- Missing documentation. New config option
wandering_stepand gcode parameterWANDERING_STEPare added with no corresponding entries indocs/Config_Reference.mdordocs/G-Codes.md. Klipper requires new config/command surface to be documented; this will block merge. - No tests. There's no test covering offset cycling, the
is_calibratinggating, or thatmesh_min/mesh_maxare reset (not accumulated) across calls. A small unit test would strengthen the PR.
| if is_calibrating: | ||
| self.wandering_state += 1 | ||
| logging.info("bed_mesh: wandering step=%.2f, " | ||
| "offset=(%.2f, %.2f)" % (step, dx, dy)) |
There was a problem hiding this comment.
update_config — wandering offset block (~lines 619–652)
-
[CRITICAL] No boundary clamping — the shift can push probe points out of range. The offset is added directly to
mesh_min/mesh_max(andorigin), but neitherupdate_confignorgenerate_pointsvalidates that the resulting points stay within the bed / probe-movable area (generate_pointsonly checks that point spacing isn't< 1mm). Ifwandering_stepis configured for a mesh whose min/max is already at the edge of the probe range — a very common setup, since people maximize mesh coverage — the shifted point will trigger a "Move out of range" kinematics error, or worse, drive the nozzle off the bed. The wear-spreading goal inherently wants the mesh near the edges, which is exactly where this is most dangerous. This needs explicit clamping ofshifted_min/shifted_max/shifted_origto the valid probe area (and for round beds, againstradius), or at minimum a documented requirement that the configured mesh leavewandering_stepof margin on all sides. -
[PROBLEM]
wandering_stateis not persisted — contradicts the "persistent" design goal. The PR description promises "persistent translational offsets ... across successive measurement cycles," butwandering_stateis an in-memory integer initialized to0in__init__. Every Klipper restart /FIRMWARE_RESTARTresets it to0, so the pattern always restarts at offset(0,0). For users who calibrate once per print and restart between prints (the typical workflow), the nozzle keeps landing on(0,0)and the feature effectively does nothing. To deliver the stated benefit, the counter should be persisted (e.g. via[save_variables]or aSAVE_CONFIG-backed value) and restored on startup. -
[PROBLEM] Counter advances even when calibration later fails.
self.wandering_state += 1runs insideupdate_config, beforegenerate_pointsand before probing actually executes.update_configis called inside thetryincmd_BED_MESH_CALIBRATE; ifgenerate_pointsraises (e.g. "min/max points too close") or the probe run aborts, the state has already advanced and that offset is skipped on the next run. Advancing the counter only after a successful calibration would be more robust. -
[SUGGESTION] Inconsistent step magnitude across the pattern. The 9-point pattern mixes orthogonal moves (distance
step) and diagonal moves (distancestep*√2 ≈ 1.41·step). That's probably fine for wear-spreading, but it's worth a comment noting the diagonal entries land ~41% farther out thanstep, since that affects the edge-margin requirement above. -
[SUGGESTION]
logging.infoon every calibrate. Minor, but logging the wandering offset atinfoon each calibration adds noise to klippy.log. Considerlogging.debug, or keep it but be aware reviewers may push back.
| self._profile_name = None | ||
| return True | ||
| def update_config(self, gcmd): | ||
| def update_config(self, gcmd, is_calibrating=False): |
There was a problem hiding this comment.
Consider adding a test to ensure that a dump/preview won't advance the counter or change the offset relative to the active state (it doesn't perturb the wandering state)
| # Mesh Bed Leveling | ||
| # | ||
| # Copyright (C) 2018-2019 Eric Callahan <arksine.code@gmail.com> | ||
| # Wandering Probe Points (WPP) Feature Concept & Implementation |
There was a problem hiding this comment.
Per-feature copyright header is unusual for this repo.
Adding # Wandering Probe Points (WPP) ... Copyright (C) 2026 Famtory near the file's top copyright line is not how Klipper typically tracks contributions (attribution lives in git history)
|
Hi @dewi-ny-je, I have just pushed an update addressing the core issues you pointed out:
Regarding the unit tests, I will look into Klipper's batch test framework to see if I can cleanly mock the Hopefully, this makes it easier for @KevinOConnor to review when he has the time. Let me know what you think! |
9eaf41c to
604a109
Compare
- Document wandering_step config and WANDERING_STEP g-code parameter. - Add warning about leaving margin for WPP expansion (~1.41x step). - Change WPP logging to debug level. - Persist wandering_state across restarts via save_variables if available. - Only advance wandering_state after a successful calibration (probe_finalize). - Remove inline feature copyright header. Signed-off-by: Hwang Younsang <famtory@gmail.com>
|
That's all I can do, it was an automated review (filtered by me to what made sense to me). Also, I honestly didn't know about save_variables. But it's not a topic for this PR. |
What does this PR do?
This PR introduces the "Wandering Probe Points (WPP)" feature to
bed_mesh.py.Currently, traditional bed probing systems hit the exact same coordinates on the PEI surface repeatedly. Over time, this repetitive probing causes physical wear, leaves filament oozing/divots, and ultimately degrades bed leveling accuracy.
WPP solves this by applying a dynamic, persistent translational offset to the entire probing grid matrix across successive probes. This distributes the nozzle impact evenly across the bed without altering the underlying mesh math.
Key Changes
wandering_stepparameter to dynamically shiftdx, dyoffsets for each probe cycle.Signed-off-by: Hwang Younsang famtory@gmail.com