diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-03-30 12:32:48 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-04-02 08:25:22 -0400 |
commit | 9f2a0257629b41abe4e47ff986a953bbdb94a4cd (patch) | |
tree | 929840564276fe0b7b41aaa6f4bfee3de3c1c004 /klippy/extras/bltouch.py | |
parent | 2b916e79c761bd91cbfa9135a62743d0270e16ad (diff) | |
download | kutter-9f2a0257629b41abe4e47ff986a953bbdb94a4cd.tar.gz kutter-9f2a0257629b41abe4e47ff986a953bbdb94a4cd.tar.xz kutter-9f2a0257629b41abe4e47ff986a953bbdb94a4cd.zip |
bltouch: Don't assume reset will do a pin_up in test_sensor()
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/bltouch.py')
-rw-r--r-- | klippy/extras/bltouch.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/klippy/extras/bltouch.py b/klippy/extras/bltouch.py index dbef49e9..56d6d323 100644 --- a/klippy/extras/bltouch.py +++ b/klippy/extras/bltouch.py @@ -146,15 +146,22 @@ class BLTouchEndstopWrapper: 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 |