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
Code:
qtdragon_handler.py
. We connect to LinuxCNC's
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
Code:
qtdragon_handler.py
in your config directory, copy the system default there. LinuxCNC will automatically prefer the local copy over the system one.
Code:
cp /usr/share/qtvcp/screens/qtdragon/qtdragon_handler.py ~/linuxcnc/configs/<your-config>/
Step 2 — Edit the handlerOpen your local
Code:
qtdragon_handler.py
and make two small changes:
In the
method, add the signal connection:
Code:
def initialized__(self):
# ... your existing code ...
STATUS.connect('interp-idle', self._on_interp_idle)
Add the callback method somewhere in the class:
Code:
def _on_interp_idle(self, obj):
if STATUS.is_mdi_mode():
ACTION.SET_MANUAL_MODE()
That's it.How It Works
-
fires whenever the interpreter becomes idle — MDI command finished, program finished, etc.
- The
Code:
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.
-
Code:
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
and
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
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!