aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArksine <arksine.code@gmail.com>2018-09-10 09:06:18 -0400
committerKevinOConnor <kevin@koconnor.net>2018-09-10 15:10:43 -0400
commitd6f72eefa1f739583dca5354df654c0d8822a1af (patch)
treecbcc7329a81dea97714e457d5bf8cae46efccf03
parentea129d869efcac53e530a46a53da096d4bda9c32 (diff)
downloadkutter-d6f72eefa1f739583dca5354df654c0d8822a1af.tar.gz
kutter-d6f72eefa1f739583dca5354df654c0d8822a1af.tar.xz
kutter-d6f72eefa1f739583dca5354df654c0d8822a1af.zip
bed_mesh: Cache last position when get_position() is called.
Fixes issue #626. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
-rw-r--r--klippy/extras/bed_mesh.py5
1 files 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: