Skip to content

Update G29.cpp#28418

Open
Maker-Paul wants to merge 3 commits into
MarlinFirmware:bugfix-2.1.xfrom
Maker-Paul:bugfix-2.1.x
Open

Update G29.cpp#28418
Maker-Paul wants to merge 3 commits into
MarlinFirmware:bugfix-2.1.xfrom
Maker-Paul:bugfix-2.1.x

Conversation

@Maker-Paul
Copy link
Copy Markdown

@Maker-Paul Maker-Paul commented Apr 28, 2026

Description

Simple update to G29.cpp (ABL) only. Adds automatic probe trigger height determination to set the Probe Z offset. avoids the probe trigger height above Z stop (Z=0) being incorrectly stored in all the bed level mesh values.

Only on machines that do not use the probe for homing when using ABL bed leveling. The probe offset will usually be larger than the home offset in these setups (it doesn't matter if its lower). When the G29 routine starts it sets the Z = 0 or home position using the homing device. But goes on to measure the bed level mesh points relative to the Z = 0 this causes all the mesh points to appear high or low by the difference between the home trigger height and the probe trigger height. This pull request simply reads the probe trigger height (which is the difference between Z home and probe trigger height) and adjusts the Z offset to account for that difference at the start of G29.

Requirements

No special requirements does not affect machines with only Z stops or machines that use the probe for Z homing.

Benefits

Machines with separate methods for homing and creating the bed level mesh will not include probe Z offset in the mesh values just the bed topology. The user can still set the Z home offset as normal.

Configurations

definitions required in configuration.h
// #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
// #define USE_PROBE_FOR_Z_HOMING
#define Z_SAFE_HOMING
#define AUTO_BED_LEVELING_BILINEAR

Related Issues

yes

will fix #27680 a simple way.
#28393

may fix other
#22653
#21727
#21833

Also #28380 identifies an issue where the mesh is incorrectly shifted by the X and Y probe offsets. it is easy to see in the bed level maps I have posted on the #28380 pull request. So should also be merged please.

@Maker-Paul
Copy link
Copy Markdown
Author

All build checks now pass and the function has been tested. it needed more robust preprocessor directives to pass all the build tests but the code was essentially correct. Had to remind myself of the interaction between compiler directives and in code if statements. So my apologies for the number of commits to get here. I couldn't find a way to rerun build tests without editing the Pull Request.

The first image shows a Bed map control taken two days ago compared to one just done. with the Bed cold.

Legend Red is above 0, Yellow is below 0, Blue is 0
The image below shows the bed is very consistent between two days ago and today.
Bed mesh cold comparison

This image below shows the surface topology after the bed has heated and soaked for 15 minutes (The bed was trammed Hot nearly a week ago)
Bed mesh Hot

The Mesh visualizer is a spread sheet I created to display the data provided from the printer with M503.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Incorrect offset applied to Bed level mesh when using a fixed Home Switch/Z stop and seperate level probe.

1 participant