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>
This commit is contained in:
Kevin O'Connor 2018-12-13 16:58:34 -05:00
parent ce064e6e2d
commit ccc25a03d5
2 changed files with 12 additions and 2 deletions

View File

@ -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:

View File

@ -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: