aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/extras/axis_twist_compensation.py9
-rw-r--r--klippy/extras/probe.py12
2 files changed, 9 insertions, 12 deletions
diff --git a/klippy/extras/axis_twist_compensation.py b/klippy/extras/axis_twist_compensation.py
index e01951ab..8f4a581a 100644
--- a/klippy/extras/axis_twist_compensation.py
+++ b/klippy/extras/axis_twist_compensation.py
@@ -38,10 +38,13 @@ class AxisTwistCompensation:
# setup calibrater
self.calibrater = Calibrater(self, config)
+ # register events
+ self.printer.register_event_handler("probe:update_results",
+ self._update_z_compensation_value)
- def get_z_compensation_value(self, pos):
+ def _update_z_compensation_value(self, pos):
if not self.z_compensations:
- return 0
+ return
x_coord = pos[0]
z_compensations = self.z_compensations
@@ -55,7 +58,7 @@ class AxisTwistCompensation:
interpolated_z_compensation = BedMesh.lerp(
interpolate_t, z_compensations[interpolate_i],
z_compensations[interpolate_i + 1])
- return interpolated_z_compensation
+ pos[2] += interpolated_z_compensation
def clear_compensations(self):
self.z_compensations = []
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py
index ca778cc9..b643dff9 100644
--- a/klippy/extras/probe.py
+++ b/klippy/extras/probe.py
@@ -309,15 +309,9 @@ class ProbeSessionHelper:
if "Timeout during endstop homing" in reason:
reason += HINT_TIMEOUT
raise self.printer.command_error(reason)
- # get z compensation from axis_twist_compensation
- axis_twist_compensation = self.printer.lookup_object(
- 'axis_twist_compensation', None)
- z_compensation = 0
- if axis_twist_compensation is not None:
- z_compensation = (
- axis_twist_compensation.get_z_compensation_value(pos))
- # add z compensation to probe position
- epos[2] += z_compensation
+ # Allow axis_twist_compensation to update results
+ self.printer.send_event("probe:update_results", epos)
+ # Report results
gcode = self.printer.lookup_object('gcode')
gcode.respond_info("probe at %.3f,%.3f is z=%.6f"
% (epos[0], epos[1], epos[2]))