aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-11 13:23:20 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-09-11 13:40:52 -0400
commit4573932f89d4bc0f0c0fea5ee40f7a2d4d3ed757 (patch)
treee240066f0defbbe987b08f7a44972b50f54bb574
parent947a7b2b0f1983df66dec6ef78ad1122e64263e3 (diff)
downloadkutter-4573932f89d4bc0f0c0fea5ee40f7a2d4d3ed757.tar.gz
kutter-4573932f89d4bc0f0c0fea5ee40f7a2d4d3ed757.tar.xz
kutter-4573932f89d4bc0f0c0fea5ee40f7a2d4d3ed757.zip
toolhead: Handle rounding errors with extrude only moves
It's possible that a g-code transform class may make an extrude only move appear as a kinematic move due to limitations of double precision math. Handle this by checking for an inconsequential move distance instead of checking for a move distance of exactly zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/toolhead.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index d94eddad..963d8052 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -21,8 +21,11 @@ class Move:
self.is_kinematic_move = True
self.axes_d = axes_d = [end_pos[i] - start_pos[i] for i in (0, 1, 2, 3)]
self.move_d = move_d = math.sqrt(sum([d*d for d in axes_d[:3]]))
- if not move_d:
+ if move_d < .000000001:
# Extrude only move
+ self.end_pos = (start_pos[0], start_pos[1], start_pos[2],
+ end_pos[3])
+ axes_d[0] = axes_d[1] = axes_d[2] = 0.
self.move_d = move_d = abs(axes_d[3])
self.is_kinematic_move = False
self.min_move_t = move_d / speed