tuning_tower: compensate z-offset (#2881)

Signed-off-by: Rubens Panfili <rubens.panfili@gmail.com>
This commit is contained in:
Rubens Panfili 2020-05-24 17:33:09 +02:00 committed by GitHub
parent 492cd3d99f
commit 9530373ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,10 @@ class TuningTower:
self.last_position = list(pos)
return pos
def calc_value(self, z):
# Compensate Z-Offset
gcode = self.printer.lookup_object("gcode")
z_offset = gcode.get_status(None)['base_zpos']
z = max(0, z - z_offset)
if self.band:
z = (math.floor(z / self.band) + .5) * self.band
return self.start + z * self.factor