From 3fae28baa95c6a50224e7500361888a3601aeb52 Mon Sep 17 00:00:00 2001 From: Rogerio Goncalves Date: Sat, 21 Dec 2024 19:48:03 -0300 Subject: [PATCH] probe: implement use_probe_xy_offsets --- docs/Config_Reference.md | 21 ++++++++++++++++++++- docs/Danger_Features.md | 1 + klippy/extras/bed_mesh.py | 6 ++++-- klippy/extras/probe.py | 6 +++++- test/klippy/z_tilt_ng.cfg | 1 + 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 29bfa8e15..a6adb9000 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -498,6 +498,9 @@ radius: #horizontal_move_z: 5 # The height (in mm) that the head should be commanded to move to # just prior to starting a probe operation. The default is 5. +#use_probe_xy_offsets: False +# If True, apply the `[probe]` XY offsets to the probed positions. The +# default is False. ``` ### Deltesian Kinematics @@ -1270,6 +1273,9 @@ Visual Examples: #bed_mesh_default: # Optionally provide the name of a profile you would like loaded on init. # By default, no profile is loaded. +#use_probe_xy_offsets: True +# If True, apply the `[probe]` XY offsets to the probed positions. The +# default is True. ``` ### [bed_tilt] @@ -1307,6 +1313,9 @@ information. #horizontal_move_z: 5 # The height (in mm) that the head should be commanded to move to # just prior to starting a probe operation. The default is 5. +#use_probe_xy_offsets: False +# If True, apply the `[probe]` XY offsets to the probed positions. The +# default is False. ``` ### [bed_screws] @@ -1394,6 +1403,9 @@ information. # Default value is CW-M3 which most printers use. A clockwise # rotation of the knob decreases the gap between the nozzle and the # bed. Conversely, a counter-clockwise rotation increases the gap. +#use_probe_xy_offsets: False +# If True, apply the `[probe]` XY offsets to the probed positions. The +# default is False. ``` ### [z_tilt] @@ -1447,7 +1459,9 @@ extended [G-Code command](G-Codes.md#z_tilt) becomes available. #increasing_threshold: 0.0000001 # Sets the threshold that probe points can increase before z_tilt aborts. # To disable the validation, set this parameter to a high value. - +#use_probe_xy_offsets: False +# If True, apply the `[probe]` XY offsets to the probed positions. The +# default is False. ``` #### [z_tilt_ng] @@ -1487,6 +1501,8 @@ commands become available, enhancing bed leveling accuracy and calibration effic # See [z_tilt] #increasing_threshold: 0.0000001 # See [z_tilt] +#use_probe_xy_offsets: False +# See [z_tilt] #extra_points: # A list in the same format as "points" above. This list contains # additional points to be probed during the two calibration commands @@ -1576,6 +1592,9 @@ Where x is the 0, 0 point on the bed #increasing_threshold: 0.0000001 # Sets the threshold that probe points can increase before qgl aborts. # To disable the validation, set this parameter to a high value. +#use_probe_xy_offsets: False +# If True, apply the `[probe]` XY offsets to the probed positions. The +# default is False. ``` ### [skew_correction] diff --git a/docs/Danger_Features.md b/docs/Danger_Features.md index 0ab9e603e..18c639f89 100644 --- a/docs/Danger_Features.md +++ b/docs/Danger_Features.md @@ -40,6 +40,7 @@ - [`[z_tilt/quad_gantry_level] increasing_threshold`](./Config_Reference.md#z_tilt) allows you to customize the allowed variation when probing multiple times - [`[z_tilt/quad_gantry_level] adaptive_horizontal_move_z`](./Config_Reference.md#z_tilt) adaptively decrease horizontal_move_z based on resulting error - z_tilt and QGL faster and safer! - [`[safe_z_home] home_y_before_x`](./Config_Reference.md#safe_z_home) let you home Y before X. +- [`[z_tilt/quad_gantry_level/etc] use_probe_xy_offsets`](./Config_Reference.md#z_tilt) let you decide if the `[probe] XY offsets should be applied to probe positions. ## Heaters, Fans, and PID changes diff --git a/klippy/extras/bed_mesh.py b/klippy/extras/bed_mesh.py index 362d6ebd2..653d5f8f5 100644 --- a/klippy/extras/bed_mesh.py +++ b/klippy/extras/bed_mesh.py @@ -380,10 +380,12 @@ def __init__(self, config, bedmesh): self._generate_points(config.error) self._profile_name = "default" self.probe_helper = probe.ProbePointsHelper( - config, self.probe_finalize, self._get_adjusted_points() + config, + self.probe_finalize, + self._get_adjusted_points(), + use_offsets=True, ) self.probe_helper.minimum_points(3) - self.probe_helper.use_xy_offsets(True) self.gcode = self.printer.lookup_object("gcode") self.gcode.register_command( "BED_MESH_CALIBRATE", diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py index e25ae1177..3a8e4bffe 100644 --- a/klippy/extras/probe.py +++ b/klippy/extras/probe.py @@ -481,6 +481,7 @@ def __init__( finalize_callback, default_points=None, option_name="points", + use_offsets=False, ): self.printer = config.get_printer() self.finalize_callback = finalize_callback @@ -501,7 +502,10 @@ def __init__( "min_horizontal_move_z", 1.0 ) self.speed = config.getfloat("speed", 50.0, above=0.0) - self.use_offsets = False + self.use_offsets = config.getboolean( + "use_probe_xy_offsets", use_offsets + ) + # Internal probing state self.lift_speed = self.speed self.probe_offsets = (0.0, 0.0, 0.0) diff --git a/test/klippy/z_tilt_ng.cfg b/test/klippy/z_tilt_ng.cfg index e20ed11c5..7c488001e 100644 --- a/test/klippy/z_tilt_ng.cfg +++ b/test/klippy/z_tilt_ng.cfg @@ -60,6 +60,7 @@ extra_points: 50,195 195,195 increasing_threshold: 0.001 +use_probe_xy_offsets: True [extruder] step_pin: PA4