homing: Improve error messages on a printer shutdown during homing

If a shutdown occurs during homing, make sure any follow up errors are
clear that the cause of the error is the shutdown.  This suppresses
the confusing "Unable to obtain 'trsync_state' response" messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-08-06 13:05:09 -04:00
parent afada5e79e
commit fa7a91a38b
1 changed files with 18 additions and 3 deletions

View File

@ -184,12 +184,24 @@ class PrinterHoming:
def manual_home(self, toolhead, endstops, pos, speed,
triggered, check_triggered):
hmove = HomingMove(self.printer, endstops, toolhead)
hmove.homing_move(pos, speed, triggered=triggered,
check_triggered=check_triggered)
try:
hmove.homing_move(pos, speed, triggered=triggered,
check_triggered=check_triggered)
except self.printer.command_error:
if self.printer.is_shutdown():
raise self.printer.command_error(
"Homing failed due to printer shutdown")
raise
def probing_move(self, mcu_probe, pos, speed):
endstops = [(mcu_probe, "probe")]
hmove = HomingMove(self.printer, endstops)
epos = hmove.homing_move(pos, speed, probe_pos=True)
try:
epos = hmove.homing_move(pos, speed, probe_pos=True)
except self.printer.command_error:
if self.printer.is_shutdown():
raise self.printer.command_error(
"Probing failed due to printer shutdown")
raise
if hmove.check_no_movement() is not None:
raise self.printer.command_error(
"Probe triggered prior to movement")
@ -208,6 +220,9 @@ class PrinterHoming:
try:
kin.home(homing_state)
except self.printer.command_error:
if self.printer.is_shutdown():
raise self.printer.command_error(
"Homing failed due to printer shutdown")
self.printer.lookup_object('stepper_enable').motor_off()
raise