Skip to content

Commit

Permalink
bltouch: Don't assume reset will do a pin_up in test_sensor()
Browse files Browse the repository at this point in the history
Some clones don't raise the pin on a reset and the ANTClabs BL-Touch
sometimes doesn't raise the pin either.

Rework the (infrequently called) sensor test code to always issue a
pin_up command before the touch command.  Also, perform a reset and
retry if the sensor test fails.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Mar 30, 2020
1 parent ad79f00 commit 934c29e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions klippy/extras/bltouch.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,22 @@ def test_sensor(self):
return
# Raise the bltouch probe and test if probe is raised
self.sync_print_time()
check_start_time = self.send_cmd('reset', duration=self.pin_move_time)
check_end_time = self.send_cmd('touch_mode')
self.send_cmd(None)
success = self.verify_state(check_start_time, check_end_time, True)
if not success:
raise homing.EndstopError("BLTouch failed to verify sensor state")
# Test was successful
self.next_test_time = check_end_time + TEST_TIME
self.sync_print_time()
for retry in range(3):
check_start_time = self.send_cmd('pin_up',
duration=self.pin_move_time)
self.send_cmd('touch_mode')
check_end_time = self.send_cmd(None)
success = self.verify_state(check_start_time, check_end_time, True)
self.sync_print_time()
if success:
# The "bltouch connection" test completed successfully
self.next_test_time = check_end_time + TEST_TIME
return
msg = "BLTouch failed to verify sensor state"
if retry >= 2:
raise homing.EndstopError(msg)
self.gcode.respond_info(msg + '; retrying.')
self.send_cmd('reset', duration=RETRY_RESET_TIME)
def multi_probe_begin(self):
if self.stow_on_each_sample:
return
Expand Down

0 comments on commit 934c29e

Please sign in to comment.