mirror of https://github.com/Desuuuu/klipper.git
z_tilt: Support retries
Support retrying Z_TILT_ADJUST a configurable number of times to a configurable tolerance both in the config or as parameters. - By default keeps original behavior of no retries. - Adds parameters RETRIES and RETRY_TOLERANCE to QUAD_GANTRY_LEVEL gcode. - adds config options retries and retry_tolerance to uad_gantry_level] - issues an error if we are getting worse intead of approaching tolerance - issues an error if retries were requested but we did not reach the tolerance in the specified number of retries the minimum change should be a single z step for those probing 2 points for 2 stepper motors and 3 for 3 stepper motors. at one point it was suggested to use the amount of z adjustment instead of the range of the probed points as a trigger for retry. I've chosen not to do this. using z adustment in these cases means the minimum unit of change is related to the angle created by the probed points and the distance to stepper motor and can be more than a couple steps which is rather unintuitive. for the case when someone is using more probed points than z steppers the probed points range will have some fixed minimum value that can't be reduced which is also unintuitive but that case should idealy be the rarer case, and the user can learn to set a higher tolerance that matches their probing setup. Signed-off-by: John "Fess" Fessenden <fess@fess.org>
This commit is contained in:
parent
bd40690bd1
commit
49c36f868b
|
@ -310,6 +310,15 @@
|
|||
#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.
|
||||
#retries: 0
|
||||
# Number of times to retry if the probed points aren't within tolerance
|
||||
#retry_tolerance: 0
|
||||
# if retries are enabled then retry if largest and smallest probed points
|
||||
# differ more than retry_tolerance.
|
||||
# Note the smallest unit of change here would be a single step. However if you
|
||||
# are probing more points than steppers then you will likely have a fixed
|
||||
# minimum value for the range of probed points which you can learn by observing
|
||||
# command output.
|
||||
|
||||
|
||||
# Moving gantry leveling using 4 independently controlled Z motors.
|
||||
|
|
|
@ -117,6 +117,7 @@ class ZTilt:
|
|||
except:
|
||||
raise config.error("Unable to parse z_positions in %s" % (
|
||||
config.get_name()))
|
||||
self.retry_helper = RetryHelper(config)
|
||||
self.probe_helper = probe.ProbePointsHelper(config, self.probe_finalize)
|
||||
self.probe_helper.minimum_points(2)
|
||||
self.z_helper = ZAdjustHelper(config, len(self.z_positions))
|
||||
|
@ -126,6 +127,7 @@ class ZTilt:
|
|||
desc=self.cmd_Z_TILT_ADJUST_help)
|
||||
cmd_Z_TILT_ADJUST_help = "Adjust the Z tilt"
|
||||
def cmd_Z_TILT_ADJUST(self, params):
|
||||
self.retry_helper.start(params)
|
||||
self.probe_helper.start_probe(params)
|
||||
def probe_finalize(self, offsets, positions):
|
||||
# Setup for coordinate descent analysis
|
||||
|
@ -154,6 +156,7 @@ class ZTilt:
|
|||
adjustments = [x*x_adjust + y*y_adjust + z_adjust
|
||||
for x, y in self.z_positions]
|
||||
self.z_helper.adjust_steppers(adjustments, speed)
|
||||
return self.retry_helper.check_retry([p[2] for p in positions])
|
||||
|
||||
def load_config(config):
|
||||
return ZTilt(config)
|
||||
|
|
Loading…
Reference in New Issue