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), }