MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.23k stars 19.22k forks source link

[FR] UBL Autofill Lower than Closest Value (Option) #26458

Open alfondehesa opened 10 months ago

alfondehesa commented 10 months ago

Is your feature request related to a problem? Please describe.

My CR10 bed is so warped that, with my 45 mm probe X offset, assuming the Z offset of the edge of the bed to be the same as the closest probed point (45 mm in) results in too high first layers.

Are you looking for hardware support?

No response

Describe the feature you want

Currently, Marlin UBL can auto-autofill points which either interpolates the height of the unreachable points if they are trending upwards (will raise Z offset if necessary). Otherwise, if the interpolated Z offset is lower than the closest point, it will default to using the closest value in an abundance of caution, so as to not drive the nozzle too far into the bed and damage it.

There should be an option in Marlin's configuration file (with proper warnings) to allow UBL autofill to infer z offsets when their interpolation results in lower values than the closest points.

Additional context

No response

stef-evotech commented 10 months ago

Hi!

Sry I don't quite get what you're after but I am assuming you need control over how the mesh points are treated which are not directly measured. If you are using UBL thats what G29 P3.x is for. I'm citing a comment from the source code:

            // P3.1  use least squares fit to fill missing mesh values
            // P3.10 zero weighting for distance, all grid points equal, best fit tilted plane
            // P3.11 10X weighting for nearest grid points versus farthest grid points
            // P3.12 100X distance weighting
            // P3.13 1000X distance weighting, approaches simple average of nearest points 

additionally P3 or P3.0 should default to something referred as "smart_fill", which I haven't had the time to investigate further yet. Now the thing is what to choose, and from my experience you either have a bed thats basically a plane but a noisy sensor, For that I would start testing P3.1 or P3.10. A distinct cup or bow in your bed could mean that your are better of with P3.13 or switiching over to ABL. And for cases like mostly a plane but your edges are "feathered" up or down in a region your sensor cannot reach, well, I figure there is no automated solution or a solution where an extrapolation of the measured points makes sense.

alfondehesa commented 9 months ago

@stef-evotech Hi!

I see... I found the same on the code. I guess I was a bit confused on its inner workings. On Marlin docs online, I see P3.XX is not mentioned, but instead they refer to this:

P3: Fill Unpopulated regions of the mesh with a fixed value (C) or use ‘smart fill’ to extrapolate from already probed points (no argument). With a C constant, the closest invalid mesh points to the nozzle will be filled, and then a repeat count can also be specified with R. Without C it does a Smart Fill, which scans the mesh from the edges inward looking for invalid mesh points. Adjacent points are used to determine the bed slope. If the bed is sloped upward from the invalid point, it takes the value of the nearest point. If sloped downward, it’s replaced by a value that puts all three points in a line. This version of G29 P3 is a quick, easy and (usually) safe way to populate unprobed mesh regions before continuing to G26 Mesh Validation Pattern. Note that this populates the mesh with unverified values. Pay attention and use caution.

To my understanding, this means that at least for P3.0, interpolations that would cause the printhead to correct downwards beyond the actual probed region are instead just assumed as being at the same height as the closest probed point, which I also assume is the reason of the "safe way to populate unprobed mesh regions" comments, as in this case the nozzle will never move downwards on unprobed territory and scratch the bed.

Granted, this is for P3.0 specifically, as besides within the Marlin source itself, the online docs only reference P3 and not P3.XX, so maybe this safeguard only applies to P3.0? Anyways, I think it could be helpful for users to be able to turn it off, even for the traditional P3.0, if desired directly from the Marlin config. Additionally, I think it would also be helpful to include P3.XX in the online docs, and perhaps give a bit more detail on the workings of those, as I tried them out but I still don't think I correctly understand how they work.