mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-08 22:35:17 -06:00
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>
This commit is contained in:
parent
f4adb29999
commit
e780049a74
2 changed files with 9 additions and 12 deletions
|
@ -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 = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue