qtDragon: Auto Return to Manual Mode After an MDI Command so MPG works

More
25 Feb 2026 05:05 #343442 by Paul_W
qtDragon: Automatically Return to Manual Mode After an MDI CommandThe ProblemIf you use a pendant with qtDragon, you've probably run into this annoyance: after executing an MDI command, LinuxCNC stays in MDI mode. Before your pendant will respond to jog inputs, you have to manually click a movement button (or otherwise trigger a mode switch) to get back into manual mode. On a busy machine this gets old fast.  I use a VistaCNC P4-S.The FixThe solution is a small addition to your
qtdragon_handler.py
. We connect to LinuxCNC's
interp-idle
STATUS signal, which fires whenever the interpreter finishes executing. When that signal fires and we're still in MDI mode, we automatically switch back to manual.Step 1 — Get a local copy of the handlerIf you don't already have a
qtdragon_handler.py
in your config directory, copy the system default there. LinuxCNC will automatically prefer the local copy over the system one.
cp /usr/share/qtvcp/screens/qtdragon/qtdragon_handler.py ~/linuxcnc/configs/<your-config>/
Step 2 — Edit the handlerOpen your local
qtdragon_handler.py
and make two small changes:In the
initialized__
method, add the signal connection:
def initialized__(self):
    # ... your existing code ...
    STATUS.connect('interp-idle', self._on_interp_idle)
Add the callback method somewhere in the class:
def _on_interp_idle(self, obj):
    if STATUS.is_mdi_mode():
        ACTION.SET_MANUAL_MODE()
That's it.How It Works
  • interp-idle
    fires whenever the interpreter becomes idle — MDI command finished, program finished, etc.
  • The
    STATUS.is_mdi_mode()
    guard ensures we only switch to manual when we're actually in MDI mode, so it won't interfere with the end of a normal G-code program run.
  • ACTION.SET_MANUAL_MODE()
    does exactly what it says — same as clicking the Manual button in the UI.
Notes
  • Tested on LinuxCNC 2.9.6 with qtDragon.
  • This should work on any 2.9.x build without modification.
  • If you're on 2.8, the same approach should work but
    STATUS
    and
    ACTION
    import paths may differ slightly depending on your build.
  • This does not affect program (auto) mode — when a G-code program finishes it will stay in auto mode as expected, since
    is_mdi_mode()
    will return False.
CreditFigured this out with a little help. Posting here so the next person doesn't spend 3 hours on it.Hope this helps someone!

Please Log in or Create an account to join the conversation.

More
25 Feb 2026 17:08 #343479 by tightmopedman9
Are there any potential drawbacks of this? I've wondered why this wasn't the standard implementation - I figured it was for good reason, so never asked. I ended up dedicating a physical button to activate MDI mode instead, but it feels like a waste of a button...

Will this modification switch back to MDI mode after a python based probing cycle (successful or failed)? I find that's the most frequent time I need to switch back to MDI mode.

Please Log in or Create an account to join the conversation.

More
25 Feb 2026 19:24 - 04 Mar 2026 00:06 #343496 by cmorley
If this is a common complaint, I could add this as an checkbox option in master branch.

As far as other wanted/annoying behaviors - feedback welcome.
I won't guarantee you always get what you want but usually can at least help with customizations

Chris
Last edit: 04 Mar 2026 00:06 by cmorley.

Please Log in or Create an account to join the conversation.

More
10 Jul 2026 12:47 #347660 by Odiug
Yes, same here. I was just searching the forum if others have the same problem or if it is just me "holding it wrong".

In my usual workflow, I load a toolprobe using a manual toolchange with automatic tool length measurement. This happend in MDI. Then I usually forget to hit the MAN button and wonder why my ShuttleXpress does not work anymore.

Same with using the toolprobe in the Probe tab. After probing we are again back to MDI mode.

I was wondering if there is a reason for being in MDI mode. From a user standpoint I was manually operating the machine, expecting to be back in manual mode after pressing a few buttons, even when those trigger MDI mode.

Guido

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.310 seconds
Powered by Kunena Forum