From 715f6557acf93f55e938777c2cce43345231f070 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:42:49 +1100 Subject: [PATCH] axis: pressing Esc harder no longer makes it slower task_stop() held axisui.abort high with time.sleep(0.3), which froze AXIS for 0.3 s per press. Presses queue up, so an operator who hit Esc 40 times in a hurry got a GUI frozen for 14 s, the most impatient waiting the longest. During a program load the presses are handled inside the parse, so the load took that much longer too. Hold the pin with a Tk timer instead, restarted on each press, so it still goes TRUE and drops 0.3 s after the last abort. The docs said 0.3 ms; it is 0.3 s. --- docs/src/gui/axis.adoc | 2 +- src/emc/usr_intf/axis/scripts/axis.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/src/gui/axis.adoc b/docs/src/gui/axis.adoc index 341ea500526..6f48ddec73c 100644 --- a/docs/src/gui/axis.adoc +++ b/docs/src/gui/axis.adoc @@ -1057,7 +1057,7 @@ real OUT axisui.jog.increment ---- AXIS has a HAL output pin that indicates when an abort has occurred. The -'axisui.abort' pin will be 'TRUE' and come back to 'FALSE' after 0.3ms. +'axisui.abort' pin will be 'TRUE' and come back to 'FALSE' 0.3 s after the last abort. ---- Type Dir Name diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index 53192ad3048..56d5e92720e 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -2047,6 +2047,12 @@ def get_states(): ) #----------------------------------------------------------- +abort_pulse = None +def end_abort_pulse(): + global abort_pulse + abort_pulse = None + comp["abort"] = False + class TclCommands(nf.TclCommands): def next_tab(event=None): current = widgets.right.raise_page() @@ -2468,8 +2474,13 @@ def task_stop(*event): comp["abort"] = True c.abort() c.wait_complete() - time.sleep(0.3) - comp["abort"] = False + # Hold axisui.abort for 0.3 s after the last press. A sleep here + # froze AXIS for 0.3 s per press, so whoever pressed Esc the most, + # in the greatest hurry, waited the longest. + global abort_pulse + if abort_pulse is not None: + root_window.after_cancel(abort_pulse) + abort_pulse = root_window.after(300, end_abort_pulse) def mdi_up_cmd(*args): if args and args[0].char: return # e.g., for KP_Up with numlock on