diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-05-24 21:04:49 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-06-10 12:20:21 -0400 |
commit | e780049a74310d23d110d8beac37b980459893a4 (patch) | |
tree | 856d9312e8d479e79970f13c66ad3e90953a8400 /klippy/extras/axis_twist_compensation.py | |
parent | f4adb2999920e203445e0d6e12b0b08650ae5e19 (diff) | |
download | kutter-e780049a74310d23d110d8beac37b980459893a4.tar.gz kutter-e780049a74310d23d110d8beac37b980459893a4.tar.xz kutter-e780049a74310d23d110d8beac37b980459893a4.zip |
probe: Use an event for axis twist compensation updates
Instead of directly calling axis_twist_compensation, send an event
that can perform the necessary updates.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/axis_twist_compensation.py')
-rw-r--r-- | klippy/extras/axis_twist_compensation.py | 9 |
1 files changed, 6 insertions, 3 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 = [] |