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>
This commit is contained in:
parent
947a7b2b0f
commit
4573932f89
|
@ -21,8 +21,11 @@ class Move:
|
||||||
self.is_kinematic_move = True
|
self.is_kinematic_move = True
|
||||||
self.axes_d = axes_d = [end_pos[i] - start_pos[i] for i in (0, 1, 2, 3)]
|
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]]))
|
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
|
# 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.move_d = move_d = abs(axes_d[3])
|
||||||
self.is_kinematic_move = False
|
self.is_kinematic_move = False
|
||||||
self.min_move_t = move_d / speed
|
self.min_move_t = move_d / speed
|
||||||
|
|
Loading…
Reference in New Issue