bltouch: Add support for stow_on_each_sample
Signed-off-by: Mike Stiemke <fandjango@gmx.de>
This commit is contained in:
parent
1dd952ac65
commit
086c131bbf
|
@ -634,6 +634,9 @@
|
||||||
# the commands "pin_up" followed by "touch_mode". This should be
|
# the commands "pin_up" followed by "touch_mode". This should be
|
||||||
# True for a genuine BLTouch v2 and earlier; the BLTouch v3 and some
|
# True for a genuine BLTouch v2 and earlier; the BLTouch v3 and some
|
||||||
# BLTouch clones require False. The default is True.
|
# BLTouch clones require False. The default is True.
|
||||||
|
#stow_on_each_sample: True
|
||||||
|
# If set to False, intermediate STOW/DEPLOY sequences on certain
|
||||||
|
# operations that use the probe multiple times will be omitted.
|
||||||
#x_offset:
|
#x_offset:
|
||||||
#y_offset:
|
#y_offset:
|
||||||
#z_offset:
|
#z_offset:
|
||||||
|
|
|
@ -27,6 +27,8 @@ class BLTouchEndstopWrapper:
|
||||||
self.printer.register_event_handler("klippy:connect",
|
self.printer.register_event_handler("klippy:connect",
|
||||||
self.handle_connect)
|
self.handle_connect)
|
||||||
self.position_endstop = config.getfloat('z_offset')
|
self.position_endstop = config.getfloat('z_offset')
|
||||||
|
self.stow_on_each_sample = config.getboolean('stow_on_each_sample',
|
||||||
|
True)
|
||||||
# Create a pwm object to handle the control pin
|
# Create a pwm object to handle the control pin
|
||||||
ppins = self.printer.lookup_object('pins')
|
ppins = self.printer.lookup_object('pins')
|
||||||
self.mcu_pwm = ppins.setup_pin('pwm', config.get('control_pin'))
|
self.mcu_pwm = ppins.setup_pin('pwm', config.get('control_pin'))
|
||||||
|
@ -60,6 +62,8 @@ class BLTouchEndstopWrapper:
|
||||||
self.gcode = self.printer.lookup_object('gcode')
|
self.gcode = self.printer.lookup_object('gcode')
|
||||||
self.gcode.register_command("BLTOUCH_DEBUG", self.cmd_BLTOUCH_DEBUG,
|
self.gcode.register_command("BLTOUCH_DEBUG", self.cmd_BLTOUCH_DEBUG,
|
||||||
desc=self.cmd_BLTOUCH_DEBUG_help)
|
desc=self.cmd_BLTOUCH_DEBUG_help)
|
||||||
|
# multi probes state
|
||||||
|
self.multi = 'OFF'
|
||||||
def _build_config(self):
|
def _build_config(self):
|
||||||
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
||||||
for stepper in kin.get_steppers():
|
for stepper in kin.get_steppers():
|
||||||
|
@ -118,6 +122,12 @@ class BLTouchEndstopWrapper:
|
||||||
self.next_cmd_time += RETRY_RESET_TIME
|
self.next_cmd_time += RETRY_RESET_TIME
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
|
def lower_probe(self):
|
||||||
|
self.test_sensor()
|
||||||
|
self.sync_print_time()
|
||||||
|
duration = max(MIN_CMD_TIME, self.pin_move_time - MIN_CMD_TIME)
|
||||||
|
self.send_cmd('pin_down', duration=duration)
|
||||||
|
self.send_cmd(None)
|
||||||
def test_sensor(self):
|
def test_sensor(self):
|
||||||
if not self.pin_up_touch_triggered:
|
if not self.pin_up_touch_triggered:
|
||||||
# Nothing to test
|
# Nothing to test
|
||||||
|
@ -138,21 +148,26 @@ class BLTouchEndstopWrapper:
|
||||||
self.next_test_time = check_end_time + TEST_TIME
|
self.next_test_time = check_end_time + TEST_TIME
|
||||||
self.sync_print_time()
|
self.sync_print_time()
|
||||||
def multi_probe_begin(self):
|
def multi_probe_begin(self):
|
||||||
pass
|
if self.stow_on_each_sample:
|
||||||
|
return
|
||||||
|
self.multi = 'FIRST'
|
||||||
def multi_probe_end(self):
|
def multi_probe_end(self):
|
||||||
pass
|
if self.stow_on_each_sample:
|
||||||
|
return
|
||||||
|
self.raise_probe()
|
||||||
|
self.multi = 'OFF'
|
||||||
def probe_prepare(self):
|
def probe_prepare(self):
|
||||||
self.test_sensor()
|
if self.multi == 'OFF' or self.multi == 'FIRST':
|
||||||
self.sync_print_time()
|
self.lower_probe()
|
||||||
duration = max(MIN_CMD_TIME, self.pin_move_time - MIN_CMD_TIME)
|
if self.multi == 'FIRST':
|
||||||
self.send_cmd('pin_down', duration=duration)
|
self.multi = 'ON'
|
||||||
self.send_cmd(None)
|
|
||||||
self.sync_print_time()
|
self.sync_print_time()
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
toolhead.flush_step_generation()
|
toolhead.flush_step_generation()
|
||||||
self.start_mcu_pos = [(s, s.get_mcu_position())
|
self.start_mcu_pos = [(s, s.get_mcu_position())
|
||||||
for s in self.mcu_endstop.get_steppers()]
|
for s in self.mcu_endstop.get_steppers()]
|
||||||
def probe_finalize(self):
|
def probe_finalize(self):
|
||||||
|
if self.multi == 'OFF':
|
||||||
self.raise_probe()
|
self.raise_probe()
|
||||||
self.sync_print_time()
|
self.sync_print_time()
|
||||||
# Verify the probe actually deployed during the attempt
|
# Verify the probe actually deployed during the attempt
|
||||||
|
|
Loading…
Reference in New Issue