From d6f72eefa1f739583dca5354df654c0d8822a1af Mon Sep 17 00:00:00 2001 From: Arksine Date: Mon, 10 Sep 2018 09:06:18 -0400 Subject: [PATCH] bed_mesh: Cache last position when get_position() is called. Fixes issue #626. Signed-off-by: Eric Callahan --- klippy/extras/bed_mesh.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/klippy/extras/bed_mesh.py b/klippy/extras/bed_mesh.py index 490148c1..19039353 100644 --- a/klippy/extras/bed_mesh.py +++ b/klippy/extras/bed_mesh.py @@ -92,12 +92,13 @@ class BedMesh: # Return last, non-transformed position if self.z_mesh is None: # No mesh calibrated, so send toolhead position - return self.toolhead.get_position() + self.last_position[:] = self.toolhead.get_position() else: # return current position minus the current z-adjustment x, y, z, e = self.toolhead.get_position() z_adjust = self.get_z_factor(z) * self.z_mesh.get_z(x, y) - return [x, y, z - z_adjust, e] + self.last_position[:] = [x, y, z - z_adjust, e] + return list(self.last_position) def move(self, newpos, speed): factor = self.get_z_factor(newpos[2]) if self.z_mesh is None or not factor: