probe: Verify the toolhead moves at least some distance on a probe
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
31ec098577
commit
a9a0bb87fa
|
@ -70,8 +70,7 @@ class PrinterProbe:
|
||||||
pos = toolhead.get_position()
|
pos = toolhead.get_position()
|
||||||
pos[2] = self.z_position
|
pos[2] = self.z_position
|
||||||
try:
|
try:
|
||||||
homing_state.homing_move(
|
homing_state.probing_move(pos, self.mcu_probe, self.speed)
|
||||||
pos, [(self.mcu_probe, "probe")], self.speed, probe_pos=True)
|
|
||||||
except homing.EndstopError as e:
|
except homing.EndstopError as e:
|
||||||
reason = str(e)
|
reason = str(e)
|
||||||
if "Timeout during endstop homing" in reason:
|
if "Timeout during endstop homing" in reason:
|
||||||
|
|
|
@ -40,9 +40,12 @@ class Homing:
|
||||||
dist_ticks = adjusted_freq * mcu_stepper.get_step_dist()
|
dist_ticks = adjusted_freq * mcu_stepper.get_step_dist()
|
||||||
ticks_per_step = math.ceil(dist_ticks / speed)
|
ticks_per_step = math.ceil(dist_ticks / speed)
|
||||||
return dist_ticks / ticks_per_step
|
return dist_ticks / ticks_per_step
|
||||||
def _homing_move(self, movepos, endstops, speed, probe_pos=False):
|
def _homing_move(self, movepos, endstops, speed,
|
||||||
|
probe_pos=False, verify_movement=False):
|
||||||
# Start endstop checking
|
# Start endstop checking
|
||||||
print_time = self.toolhead.get_last_move_time()
|
print_time = self.toolhead.get_last_move_time()
|
||||||
|
start_mcu_pos = [(s, name, s.get_mcu_position())
|
||||||
|
for es, name in endstops for s in es.get_steppers()]
|
||||||
for mcu_endstop, name in endstops:
|
for mcu_endstop, name in endstops:
|
||||||
min_step_dist = min([s.get_step_dist()
|
min_step_dist = min([s.get_step_dist()
|
||||||
for s in mcu_endstop.get_steppers()])
|
for s in mcu_endstop.get_steppers()])
|
||||||
|
@ -74,10 +77,18 @@ class Homing:
|
||||||
mcu_endstop.home_finalize()
|
mcu_endstop.home_finalize()
|
||||||
if error is not None:
|
if error is not None:
|
||||||
raise EndstopError(error)
|
raise EndstopError(error)
|
||||||
def homing_move(self, movepos, endstops, speed, probe_pos=False):
|
# Check if some movement occurred
|
||||||
for mcu_endstop, name in endstops:
|
if verify_movement:
|
||||||
mcu_endstop.home_prepare()
|
for s, name, pos in start_mcu_pos:
|
||||||
self._homing_move(movepos, endstops, speed, probe_pos)
|
if s.get_mcu_position() == pos:
|
||||||
|
if probe_pos:
|
||||||
|
raise EndstopError("Probe triggered prior to movement")
|
||||||
|
raise EndstopError(
|
||||||
|
"Endstop %s still triggered after retract" % (name,))
|
||||||
|
def probing_move(self, movepos, mcu_probe, speed):
|
||||||
|
mcu_probe.home_prepare()
|
||||||
|
self._homing_move(movepos, [(mcu_probe, "probe")], speed,
|
||||||
|
probe_pos=True, verify_movement=True)
|
||||||
def home(self, forcepos, movepos, endstops, speed, second_home=False):
|
def home(self, forcepos, movepos, endstops, speed, second_home=False):
|
||||||
if second_home and forcepos == movepos:
|
if second_home and forcepos == movepos:
|
||||||
return
|
return
|
||||||
|
@ -96,18 +107,9 @@ class Homing:
|
||||||
for es, n in endstops for s in es.get_steppers()])
|
for es, n in endstops for s in es.get_steppers()])
|
||||||
self.toolhead.dwell(est_steps * HOMING_STEP_DELAY, check_stall=False)
|
self.toolhead.dwell(est_steps * HOMING_STEP_DELAY, check_stall=False)
|
||||||
speed = self._get_homing_speed(speed, endstops)
|
speed = self._get_homing_speed(speed, endstops)
|
||||||
# Setup for retract verification
|
|
||||||
self.toolhead.get_last_move_time()
|
|
||||||
start_mcu_pos = [(s, name, s.get_mcu_position())
|
|
||||||
for es, name in endstops for s in es.get_steppers()]
|
|
||||||
# Issue homing move
|
# Issue homing move
|
||||||
self._homing_move(movepos, endstops, speed)
|
self._homing_move(movepos, endstops, speed,
|
||||||
# Verify retract led to some movement on second home
|
verify_movement=second_home and self.verify_retract)
|
||||||
if second_home and self.verify_retract:
|
|
||||||
for s, name, pos in start_mcu_pos:
|
|
||||||
if s.get_mcu_position() == pos:
|
|
||||||
raise EndstopError(
|
|
||||||
"Endstop %s still triggered after retract" % (name,))
|
|
||||||
def home_axes(self, axes):
|
def home_axes(self, axes):
|
||||||
self.changed_axes = axes
|
self.changed_axes = axes
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue