Fix bilinear ABL grid_start probe/nozzle coordinate mixup#28380
Open
PenguinAkiko wants to merge 1 commit intoMarlinFirmware:bugfix-2.1.xfrom
Open
Fix bilinear ABL grid_start probe/nozzle coordinate mixup#28380PenguinAkiko wants to merge 1 commit intoMarlinFirmware:bugfix-2.1.xfrom
PenguinAkiko wants to merge 1 commit intoMarlinFirmware:bugfix-2.1.xfrom
Conversation
The variable abl.probe_position_lf is in probe-space, but bedlevel.grid_start is consumed as a nozzle-space origin for mesh interpolation. This caused the entire bilinear mesh to be shifted by the probe offset on machines with a non-zero XY offset. Convert the bilinear lower-left grid origin before comparing or storing the mesh, and apply the same conversion in M420 S2. Add Probe::convert_to_nozzle_xy() to centralize the conversion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a critical coordinate-space mixup for the
bedlevel.grid_startposition when using Bilinear Auto Bed Leveling (AUTO_BED_LEVELING_BILINEAR).The Problem:
The bilinear ABL probing process builds its mesh in probe-space, where
abl.probe_position_lfrepresents the coordinate directly under the probe. However, the resultingbedlevel.grid_startvalue is later consumed by other systems (likebedlevel.get_z_correction()) as a motion/nozzle-space origin.On machines with a non-zero
NOZZLE_TO_PROBE_OFFSETin the XY plane, this discrepancy caused the entire leveling mesh to be incorrectly shifted by the probe's XY offset, leading to inaccurate bed compensation.The Solution:
To resolve this, this PR introduces a centralized utility function,
Probe::convert_to_nozzle_xy(), to handle the conversion from probe-space to nozzle-space. This function is now used in two key locations:G29: The bilinear grid origin is now converted to nozzle-space before it is compared with a stored mesh or saved withbedlevel.set_grid().M420 S2: The test pattern generator is also updated to use the same conversion, ensuring that all methods of generating a bilinear mesh use consistent, nozzle-space coordinates for the grid origin.This change has no functional effect on setups where the XY probe offset is zero or when using
NOZZLE_AS_PROBE.Requirements
Any 3D printer configured with
AUTO_BED_LEVELING_BILINEAR.Benefits
Fixes a bug that incorrectly shifted the entire Bilinear ABL mesh by the probe's XY offset.
Configurations
No configuration files are attached as the change is hardware-independent.
To test this PR, any configuration with the following enabled will reproduce the issue and verify the fix:
Related Issues
Fixes a bug that does not appear to have a corresponding open issue.