Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new 'P' (precise probing) option to G28 #27523

Open
wants to merge 1 commit into
base: bugfix-2.1.x
Choose a base branch
from

Conversation

nickweedon
Copy link

@nickweedon nickweedon commented Nov 9, 2024

Description

This feature addesses feature request #9802 and adds a new flag ('P' for precise homing) to G28 (Homing) that provides an alternative to the 'bump' option which is an option configured in Marlin via HOMING_BUMP_MM that causes G28 to perform a second slower and more accurate probe. The 'P' option causes the G28 gcode to use the same algorithm used by bed leveling.

The new 'P' flag is very useful for machines that have probing accuracy issues that cannot be solved by bump. Since the 'P' option allows for all the same flags and options to be configured as for bed leveling, it is possible to configure multiple probes as well as turn off stepper motors and bed heating functions to reduce EMI interferance (as per what already exists for bed leveling). A first probe is still necessary for an initial home as the 'P' option will take the error that it finds and use that as a correction to the homing position.

It is recommend although not mandatory to use this with safe homing as Z_SAFE_HOMING_X_POINT and Z_SAFE_HOMING_Y_POINT can then be set to precisely match a known reference point (e.g. a point on the UBL mesh that is always adjusted to be at Z 0).

If this change looks acceptable then i will follow up with a PR to update the G28 documentation also. I know that this feature has been requested since 2018 so hopefully this is a welcomed addition :)

Requirements

Requires a Bed Probe (i.e. #define HAS_BED_PROBE)

Benefits

Useful alternative to G28 'bump' that allows the G28 homing to be much for configurable. In particular it can benefit for stepper motor and bed heater control to mitigate EMI as well as to use the MULTIPLE_PROBING and EXTRA_PROBING options.
The way that these existing options work (and have always worked but perhaps been scarcely documented) is as follows (this code can be found in probe.cpp):

  1. The machine will probe TOTAL_PROBING ((MULTIPLE_PROBING + EXTRA_PROBING) number of times.
  2. The results of the probe will be sorted
  3. If EXTRA_PROBING is greater than zero then the values fartherest from the middle will be removed. This is accomplished by iteratively comparing both the start and the end values against the middle value and upon each iteration, remove the start or end value that deviates the most from the middle value.
  4. Take the average of all that remain and return this as the final value.

I believe this is actually a very good way to remove outliers and works very well for probes that periodically return erroneous results that are significant outliers and would otherwise throw off the whole average.

Configurations

No configuration required

Related Issues

* This new flag causes G28 to execute the same probing algorithm that is
  used when bed leveling in order to increase accuracy. Provides a good
  alternative to 'bump' probing for probes that are still intermittently
  innacurate (I recommend disabling HOMING_BUMP_MM for the Z axis when
  using this option exclusively).
* Only avaialbe when 'HAS_BED_PROBE' is enabled and is configurable via
  all the same options as the bed level probe.
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.

1 participant