MarlinFirmware / MarlinFirmware/Marlin

[FR] G29 J2 should use bilinear correction

Open
#13,601 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T: Feature Request
Dominant language
C++
Stars
17.6k
Forks
19.7k
Avg merge
3d 5h
Merged PRs (30d)
21

Description

Description

Currently, G29 J2 appears to fit a plane, as after doing it, the surface at the probed points is not exactly zero. However, the only reason to use 4-point (or more) leveling rather than 3-point is that the bed isn't, in fact, a plane. It would be great if G29 J2 could instead be used to apply an overall bilinear correction (or meshed for >2) to the loaded mesh.

Steps to Reproduce
  1. Run G29 J2.
  2. The height of the probed points should be exactly zero, like they are if you use a 2x2 UBL mesh and probe it with G29 P1.
Additional Information

I used to use bilinear leveling, but the shape of my bed deviates significantly (by ~0.5mm) from a bilinear shape. To correct for this, I want to use UBL. I've probed a 7x7 grid of my bed. However, depending on exact temperature etc, the overall height of the bed and the length of the nozzle changes. For that reason, I want to use a G29 J2 to apply an overall bilinear correction to the previously probed mesh. When I do this now, it results in a significant (~0.3mm) offset towards the edges of the grid. I think this is because it fits a plane but I already know a plane is not a good description of the shape of the bed.

From glancing at the code for G29 J in ubl_G29.cpp, it appears that it doesn't even approximate the difference between the loaded mesh and the actual probed points with a plane, it turns off the leveling data, fits a plane to the probed points, and then rotates the mesh by that plane.

If we have to fit a plane, I believe a better way of doing it would be to fit the plane to the points including correction. But using bilinear should be both easier and better.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ubl_G29.cpp at the G29 J handling and compare its current correction behavior with the 2x2 UBL mesh behavior described in the issue. Check how the loaded mesh and probed points are used, then verify with the reproduction steps that the probed points reach zero and the existing mesh shape is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.