bltouch: Retry reset/pin_up if the raise probe attempt fails
There's no harm in retrying the attempt if it appears to have failed for some reason. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
04c6e1f646
commit
a5d3d161d3
|
@ -10,6 +10,7 @@ SIGNAL_PERIOD = 0.025600
|
||||||
MIN_CMD_TIME = 4 * SIGNAL_PERIOD
|
MIN_CMD_TIME = 4 * SIGNAL_PERIOD
|
||||||
|
|
||||||
TEST_TIME = 5 * 60.
|
TEST_TIME = 5 * 60.
|
||||||
|
RETRY_RESET_TIME = 1.
|
||||||
ENDSTOP_REST_TIME = .001
|
ENDSTOP_REST_TIME = .001
|
||||||
ENDSTOP_SAMPLE_TIME = .000015
|
ENDSTOP_SAMPLE_TIME = .000015
|
||||||
ENDSTOP_SAMPLE_COUNT = 4
|
ENDSTOP_SAMPLE_COUNT = 4
|
||||||
|
@ -65,7 +66,6 @@ class BLTouchEndstopWrapper:
|
||||||
for stepper in kin.get_steppers('Z'):
|
for stepper in kin.get_steppers('Z'):
|
||||||
stepper.add_to_endstop(self)
|
stepper.add_to_endstop(self)
|
||||||
def handle_connect(self):
|
def handle_connect(self):
|
||||||
self.sync_mcu_print_time()
|
|
||||||
try:
|
try:
|
||||||
self.raise_probe()
|
self.raise_probe()
|
||||||
except homing.EndstopError as e:
|
except homing.EndstopError as e:
|
||||||
|
@ -103,12 +103,25 @@ class BLTouchEndstopWrapper:
|
||||||
for s, pos in zip(self.mcu_endstop.get_steppers(), prev_positions):
|
for s, pos in zip(self.mcu_endstop.get_steppers(), prev_positions):
|
||||||
s.set_commanded_position(pos)
|
s.set_commanded_position(pos)
|
||||||
def raise_probe(self):
|
def raise_probe(self):
|
||||||
self.send_cmd('reset')
|
for retry in range(3):
|
||||||
check_start_time = self.send_cmd('pin_up', duration=self.pin_move_time)
|
self.sync_mcu_print_time()
|
||||||
check_end_time = self.send_cmd(None)
|
self.send_cmd('reset')
|
||||||
if self.pin_up_not_triggered:
|
check_start_time = self.send_cmd('pin_up',
|
||||||
self.verify_state(check_start_time, check_end_time,
|
duration=self.pin_move_time)
|
||||||
False, "raise probe")
|
check_end_time = self.send_cmd(None)
|
||||||
|
if self.pin_up_not_triggered:
|
||||||
|
try:
|
||||||
|
self.verify_state(check_start_time, check_end_time,
|
||||||
|
False, "raise probe")
|
||||||
|
except homing.EndstopError as e:
|
||||||
|
if retry >= 2:
|
||||||
|
raise
|
||||||
|
msg = "Failed to verify BLTouch probe is raised; retrying."
|
||||||
|
logging.warning(msg)
|
||||||
|
self.gcode.respond_info(msg)
|
||||||
|
self.next_cmd_time += RETRY_RESET_TIME
|
||||||
|
continue
|
||||||
|
break
|
||||||
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,7 +151,6 @@ class BLTouchEndstopWrapper:
|
||||||
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 home_finalize(self):
|
def home_finalize(self):
|
||||||
self.sync_mcu_print_time()
|
|
||||||
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