diff --git a/src/py/bbctrl/Mach.py b/src/py/bbctrl/Mach.py index 4628dc4..ef99ccf 100644 --- a/src/py/bbctrl/Mach.py +++ b/src/py/bbctrl/Mach.py @@ -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