ProbePointsHelper: Optionally add xy offsets to probe points

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2019-11-14 16:37:31 -05:00 committed by KevinOConnor
parent 3fb0b7e4bc
commit ec58b23f3b
1 changed files with 6 additions and 0 deletions

View File

@ -283,6 +283,7 @@ class ProbePointsHelper:
self.name)) self.name))
self.horizontal_move_z = config.getfloat('horizontal_move_z', 5.) self.horizontal_move_z = config.getfloat('horizontal_move_z', 5.)
self.speed = config.getfloat('speed', 50., above=0.) self.speed = config.getfloat('speed', 50., above=0.)
self.use_offsets = False
# Internal probing state # Internal probing state
self.lift_speed = self.speed self.lift_speed = self.speed
self.probe_offsets = (0., 0., 0.) self.probe_offsets = (0., 0., 0.)
@ -291,6 +292,8 @@ class ProbePointsHelper:
if len(self.probe_points) < n: if len(self.probe_points) < n:
raise self.printer.config_error( raise self.printer.config_error(
"Need at least %d probe points for %s" % (n, self.name)) "Need at least %d probe points for %s" % (n, self.name))
def use_xy_offsets(self, use_offsets):
self.use_offsets = use_offsets
def get_lift_speed(self): def get_lift_speed(self):
return self.lift_speed return self.lift_speed
def _move_next(self): def _move_next(self):
@ -313,6 +316,9 @@ class ProbePointsHelper:
self.results = [] self.results = []
# Move to next XY probe point # Move to next XY probe point
curpos[:2] = self.probe_points[len(self.results)] curpos[:2] = self.probe_points[len(self.results)]
if self.use_offsets:
curpos[0] -= self.probe_offsets[0]
curpos[1] -= self.probe_offsets[1]
toolhead.move(curpos, self.speed) toolhead.move(curpos, self.speed)
self.gcode.reset_last_position() self.gcode.reset_last_position()
return False return False