Mach.home: end the homing cycle when external homing fails

When ext.home() raised, Mach.home logged the error but never reset
the cycle from 'homing' back to 'idle'. The AVR had not moved (the
homing was external), so its state stayed at READY without a
transition - meaning _update's normal 'state changed to READY ->
exit cycle' path never fired and the UI was permanently locked out
of every action that requires is_idle (jog buttons, the home button
itself, run, etc).

Wrap the external-homing block in try/except and force the cycle
back to idle on any failure. The success path is unchanged - it
still relies on the AVR's queued set_axis + G92 acks to bring the
state back to READY.
This commit is contained in:
2026-05-03 13:13:29 +02:00
parent 983e06b53d
commit ca7e30aa05

View File

@@ -359,8 +359,10 @@ class Mach(Comm):
continue
self.mlog.info('Homing external %s axis via auxcnc' %
axis.upper())
cycle_started = False
try:
self._begin_cycle('homing')
cycle_started = True
ext.home()
home_mm = ext.home_position_mm
# 1) Update AVR: no motor steps, just position sync.
@@ -377,6 +379,19 @@ class Mach(Comm):
except Exception as e:
self.mlog.error(
'External axis homing failed: %s' % e)
# Make sure we clean up the cycle so the UI does
# not stay locked out of jog/home/start. The AVR
# never moved during external homing, so its
# state never changes back to READY (which is
# what _update normally relies on to exit the
# cycle). Drop straight to idle.
if cycle_started and self._get_cycle() == 'homing':
try:
self._set_cycle('idle')
except Exception:
self.mlog.exception(
'Failed to reset cycle to idle '
'after external homing error')
continue
# If this is not a request to home a specific axis and the