diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-12-13 16:58:34 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-12-16 11:06:41 -0500 |
commit | ccc25a03d5fc4a17f7112e2b343335aa71a48faf (patch) | |
tree | b1882a61c25f6718ebb84dc08a66e1b4be0c519d | |
parent | ce064e6e2d842632c5c39341882f24f6ed20243c (diff) | |
download | kutter-ccc25a03d5fc4a17f7112e2b343335aa71a48faf.tar.gz kutter-ccc25a03d5fc4a17f7112e2b343335aa71a48faf.tar.xz kutter-ccc25a03d5fc4a17f7112e2b343335aa71a48faf.zip |
bltouch: Add a config option to disable the bltouch sensor test
It appears some bltouch "clones" do not report the probe as triggered
when put in "touch mode" while the pin is raised. Add a config option
to allow users to disable the test.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | config/example-extras.cfg | 8 | ||||
-rw-r--r-- | klippy/extras/bltouch.py | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg index 27219b3f..6448f16a 100644 --- a/config/example-extras.cfg +++ b/config/example-extras.cfg @@ -54,9 +54,15 @@ #control_pin: # Pin connected to the BLTouch control pin. This parameter must be # provided. -#pin_move_time: +#pin_move_time: 0.200 # The amount of time (in seconds) that it takes the BLTouch pin to # move up or down. The default is 0.200 seconds. +#test_sensor_pin: True +# This enables a software test of the BLTouch sensor pin during the +# first probe attempt. The test can help catch cases where the +# BLTouch is not responding correctly. It may be necessary to +# disable this test for some BLTouch "clones" if they consistently +# report "BLTouch sensor test failed" errors. The default is True. #x_offset: #y_offset: #z_offset: diff --git a/klippy/extras/bltouch.py b/klippy/extras/bltouch.py index 9da9646d..58a78ca4 100644 --- a/klippy/extras/bltouch.py +++ b/klippy/extras/bltouch.py @@ -23,7 +23,6 @@ Commands = { class BLTouchEndstopWrapper: def __init__(self, config): self.printer = config.get_printer() - self.next_test_time = 0. self.position_endstop = config.getfloat('z_offset') # Create a pwm object to handle the control pin ppins = self.printer.lookup_object('pins') @@ -36,6 +35,9 @@ class BLTouchEndstopWrapper: mcu = pin_params['chip'] mcu.register_config_callback(self._build_config) self.mcu_endstop = mcu.setup_pin('endstop', pin_params) + # Setup for sensor test + self.next_test_time = 0. + self.test_sensor_pin = config.getboolean('test_sensor_pin', True) # Calculate pin move time pmt = max(config.getfloat('pin_move_time', 0.200), MIN_CMD_TIME) self.pin_move_time = math.ceil(pmt / SIGNAL_PERIOD) * SIGNAL_PERIOD @@ -58,6 +60,8 @@ class BLTouchEndstopWrapper: def send_cmd(self, print_time, cmd): self.mcu_pwm.set_pwm(print_time, Commands[cmd] / SIGNAL_PERIOD) def test_sensor(self): + if not self.test_sensor_pin: + return toolhead = self.printer.lookup_object('toolhead') print_time = toolhead.get_last_move_time() if print_time < self.next_test_time: |