From 2d5f9b6cdac98fec56afb9cdca37ad7ac2795fd6 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 15 Aug 2020 15:59:14 -0400 Subject: [PATCH] gcode: Remove unneeded base_xpos variables from get_status() Convert the only user of base_zpos to use gcode_position. Signed-off-by: Kevin O'Connor --- klippy/extras/tuning_tower.py | 10 ++++++---- klippy/gcode.py | 4 ---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/klippy/extras/tuning_tower.py b/klippy/extras/tuning_tower.py index 753e5433..87a0093d 100644 --- a/klippy/extras/tuning_tower.py +++ b/klippy/extras/tuning_tower.py @@ -13,6 +13,7 @@ class TuningTower: self.normal_transform = None self.last_position = [0., 0., 0., 0.] self.last_z = self.start = self.factor = self.band = 0. + self.last_command_value = None self.command_fmt = "" # Register command self.gcode = self.printer.lookup_object("gcode") @@ -35,6 +36,7 @@ class TuningTower: self.command_fmt = "%s %s=%%.9f" % (command, parameter) self.normal_transform = self.gcode.set_move_transform(self, force=True) self.last_z = -99999999.9 + self.last_command_value = None self.get_position() gcmd.respond_info("Starting tuning test (start=%.6f factor=%.6f)" % (self.start, self.factor)) @@ -57,11 +59,11 @@ class TuningTower: self.end_test() else: # Process update - z_offset = self.gcode.get_status()['base_zpos'] - oldval = self.calc_value(self.last_z - z_offset) - newval = self.calc_value(z - z_offset) + gcode_z = self.gcode.get_status()['gcode_position'].z + newval = self.calc_value(gcode_z) self.last_z = z - if newval != oldval: + if newval != self.last_command_value: + self.last_command_value = newval self.gcode.run_script_from_command(self.command_fmt % (newval,)) # Forward move to actual handler diff --git a/klippy/gcode.py b/klippy/gcode.py index 579a7c64..8180e2e9 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -187,10 +187,6 @@ class GCodeParser: 'last_ypos': self.last_position[1], 'last_zpos': self.last_position[2], 'last_epos': self.last_position[3], - 'base_xpos': self.base_position[0], - 'base_ypos': self.base_position[1], - 'base_zpos': self.base_position[2], - 'base_epos': self.base_position[3], 'homing_origin': homing.Coord(*self.homing_position), 'gcode_position': homing.Coord(*move_position), }