From 9e0015fe41616c5dd3caf95f5233d8cd5091b5a0 Mon Sep 17 00:00:00 2001 From: david mueller Date: Fri, 12 Dec 2025 21:49:09 +0100 Subject: [PATCH] Fix homing bug when trying to home while a homing sequence is already in progress Fixes https://github.com/LinuxCNC/linuxcnc/issues/3314 The modification to 'command.c' prevents the homing process breaking where the joint would continue moving indefinitely. The modifications to axis.py and gmoccapy.py prevents the gui freezing that occurs due to wait_complete() timing out to the default 5 seconds. --- src/emc/motion/command.c | 5 ++++- src/emc/usr_intf/axis/scripts/axis.py | 5 +++++ src/emc/usr_intf/gmoccapy/gmoccapy.py | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c index 0b79061d39b..8a660a20f44 100644 --- a/src/emc/motion/command.c +++ b/src/emc/motion/command.c @@ -1381,7 +1381,10 @@ void emcmotCommandHandler_locked(void *arg, long servo_period) joint_num); return; } - + if ( get_homing_is_active() ) { + reportError("Homing not possible until current homing process is finished.\n"); + return; + } if (!GET_MOTION_ENABLE_FLAG()) { break; } diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index ccb7ebe5939..c61cbc9c919 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -1952,6 +1952,11 @@ def all_homed(): return isHomed def go_home(num): + s.poll() + for j in range(s.joints): + if s.joint[j]["homing"]: + print(_("Homing not possible until current homing process is finished.")) + return set_motion_teleop(0) c.home(num) c.wait_complete() diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index c14809d7d6e..fbebf0d4516 100644 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -3857,6 +3857,11 @@ def _on_btn_home_back_clicked(self, widget): def _on_btn_home_clicked(self, widget): # home axis or joint? LOG.debug("on button home clicked = {0}".format(widget.get_property("name"))) + self.stat.poll() + for j in range(self.stat.joints): + if self.stat.joint[j]["homing"]: + self._show_error((13, _("Homing not possible until current homing process is finished."))) + return if "axis" in widget.get_property("name"): value = widget.get_property("name")[-1] # now get the joint from directory by the value