mirror of https://github.com/Desuuuu/klipper.git
bltouch: Verify probe always deploys during a homing operation
Verify that there is always some movement during a probing operation. This is normally done by the homing.py code (via its verify_movement check), but that check may not be enabled when z_virtual_endstop is used. So, always enable the check in the bltouch.py code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
293366d033
commit
26e818d900
|
@ -38,6 +38,7 @@ class BLTouchEndstopWrapper:
|
||||||
# Setup for sensor test
|
# Setup for sensor test
|
||||||
self.next_test_time = 0.
|
self.next_test_time = 0.
|
||||||
self.test_sensor_pin = config.getboolean('test_sensor_pin', True)
|
self.test_sensor_pin = config.getboolean('test_sensor_pin', True)
|
||||||
|
self.start_mcu_pos = []
|
||||||
# Calculate pin move time
|
# Calculate pin move time
|
||||||
pmt = max(config.getfloat('pin_move_time', 0.200), MIN_CMD_TIME)
|
pmt = max(config.getfloat('pin_move_time', 0.200), MIN_CMD_TIME)
|
||||||
self.pin_move_time = math.ceil(pmt / SIGNAL_PERIOD) * SIGNAL_PERIOD
|
self.pin_move_time = math.ceil(pmt / SIGNAL_PERIOD) * SIGNAL_PERIOD
|
||||||
|
@ -94,6 +95,8 @@ class BLTouchEndstopWrapper:
|
||||||
self.send_cmd(print_time + self.pin_move_time, 'touch_mode')
|
self.send_cmd(print_time + self.pin_move_time, 'touch_mode')
|
||||||
toolhead.dwell(self.pin_move_time + MIN_CMD_TIME)
|
toolhead.dwell(self.pin_move_time + MIN_CMD_TIME)
|
||||||
self.mcu_endstop.home_prepare()
|
self.mcu_endstop.home_prepare()
|
||||||
|
self.start_mcu_pos = [(s, s.get_mcu_position())
|
||||||
|
for s in self.mcu_endstop.get_steppers()]
|
||||||
def home_finalize(self):
|
def home_finalize(self):
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
print_time = toolhead.get_last_move_time()
|
print_time = toolhead.get_last_move_time()
|
||||||
|
@ -101,6 +104,10 @@ class BLTouchEndstopWrapper:
|
||||||
self.send_cmd(print_time + MIN_CMD_TIME, 'pin_up')
|
self.send_cmd(print_time + MIN_CMD_TIME, 'pin_up')
|
||||||
self.send_cmd(print_time + MIN_CMD_TIME + self.pin_move_time, None)
|
self.send_cmd(print_time + MIN_CMD_TIME + self.pin_move_time, None)
|
||||||
toolhead.dwell(self.pin_move_time + MIN_CMD_TIME)
|
toolhead.dwell(self.pin_move_time + MIN_CMD_TIME)
|
||||||
|
# Verify the probe actually deployed during the attempt
|
||||||
|
for s, mcu_pos in self.start_mcu_pos:
|
||||||
|
if s.get_mcu_position() == mcu_pos:
|
||||||
|
raise homing.EndstopError("BLTouch failed to deploy")
|
||||||
self.mcu_endstop.home_finalize()
|
self.mcu_endstop.home_finalize()
|
||||||
def home_start(self, print_time, sample_time, sample_count, rest_time):
|
def home_start(self, print_time, sample_time, sample_count, rest_time):
|
||||||
rest_time = min(rest_time, ENDSTOP_REST_TIME)
|
rest_time = min(rest_time, ENDSTOP_REST_TIME)
|
||||||
|
|
|
@ -78,7 +78,11 @@ class Homing:
|
||||||
else:
|
else:
|
||||||
self.toolhead.set_position(movepos)
|
self.toolhead.set_position(movepos)
|
||||||
for mcu_endstop, name in endstops:
|
for mcu_endstop, name in endstops:
|
||||||
|
try:
|
||||||
mcu_endstop.home_finalize()
|
mcu_endstop.home_finalize()
|
||||||
|
except EndstopError as e:
|
||||||
|
if error is None:
|
||||||
|
error = str(e)
|
||||||
if error is not None:
|
if error is not None:
|
||||||
raise EndstopError(error)
|
raise EndstopError(error)
|
||||||
# Check if some movement occurred
|
# Check if some movement occurred
|
||||||
|
|
Loading…
Reference in New Issue