qtdragon mod

  • Mr. Mass
  • Mr. Mass's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
23 Nov 2025 12:36 #339047 by Mr. Mass
Replied by Mr. Mass on topic qtdragon mod
Thanks for the explanation, it really helped. I made indicators for e-stop, on/off, manual mode, and MDI. There was a slight issue with auto mode. I wanted to make indicators for auto mode, running programs, and pause. This is the only way I could do it:
STATUS.connect("interp-run",lambda w: self.set_auto_led()) 
STATUS.connect("interp-paused",lambda w: self.set_auto_led())
STATUS.connect("interp-idle",lambda w: self.set_auto_led())
STATUS.connect("interp-waiting",lambda w: self.set_auto_led())

def set_auto_led(self):
    c = ""
    if STATUS.is_auto_running() and STATUS.is_auto_mode() and not STATUS.is_auto_paused():
        c = "blue"
        self.set_led_color(c)
    elif STATUS.is_auto_paused() and STATUS.is_auto_mode():
        c = "aquamarine"
        self.set_led_color(c)
    elif STATUS.is_auto_mode():
        c = "green_dark"
        self.set_led_color(c)

def set_led_color(self, color):        
    print(color, self.LED_color[color])
    self.h["led-red"] = self.LED_color[color][0]
    self.h["led-green"] = self.LED_color[color][1]
    self.h["led-blue"] =  self.LED_color[color][2]

Is this ok, or is there a more elegant way?

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

  • Mr. Mass
  • Mr. Mass's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
04 Dec 2025 12:14 #339721 by Mr. Mass
Replied by Mr. Mass on topic qtdragon mod
A new day, new challenges
I'm trying to configure MPG, added HAL pins, seems like everything worked out. But there is a problem I can't solve. When MPG is activated, it is still possible to change the increments of movement on the screen. It would be great if this widget could only display the selected increment without the ability to change it. And when MPG is inactive, it should be possible to change the value on the screen again. But I couldn't figure out how to do it.

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

More
05 Dec 2025 04:38 #339750 by cmorley
Replied by cmorley on topic qtdragon mod
Do you mean you are using HALUI to do MPG jogging?

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

  • Mr. Mass
  • Mr. Mass's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
05 Dec 2025 09:47 - 05 Dec 2025 09:49 #339753 by Mr. Mass
Replied by Mr. Mass on topic qtdragon mod
No, I added my pins and linked them to jog_increments widget:
[code][code]pin = QHAL.newpin("mpg.mpg-inc.1", QHAL.HAL_BIT, QHAL.HAL_IN)
pin.value_changed.connect(lambda s: self.w.jogincrements_linear.setCurrentIndex(1))
pin = QHAL.newpin("mpg.mpg-inc.2", QHAL.HAL_BIT, QHAL.HAL_IN)
pin.value_changed.connect(lambda s: self.w.jogincrements_linear.setCurrentIndex(2))
pin = QHAL.newpin("mpg.mpg-inc.3", QHAL.HAL_BIT, QHAL.HAL_IN)
pin.value_changed.connect(lambda s: self.w.jogincrements_linear.setCurrentIndex(3))
pin = QHAL.newpin("mpg.mpg-inc.cont", QHAL.HAL_BIT, QHAL.HAL_IN)
pin.value_changed.connect(lambda s: self.w.jogincrements_linear.setCurrentIndex(0))


[code][code][code]But I would like to be able to enable/disable the increment selection from the screen, only showing the current value. Perhaps there is a way to disable the drop-down menu or something like that.
[/code][/code][/code][/code][/code]
Last edit: 05 Dec 2025 09:49 by Mr. Mass.

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

More
05 Dec 2025 19:45 #339767 by cmorley
Replied by cmorley on topic qtdragon mod
adding:
        self.w.jogincrements_linear.setEnabled(0)

to the end of
    def init_widgets(self):

Will make it not respond to screen clicks, but should still respond from HAL pin changes

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

  • Mr. Mass
  • Mr. Mass's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
06 Dec 2025 08:07 #339787 by Mr. Mass
Replied by Mr. Mass on topic qtdragon mod
Oh, that works great, thank you very much. I even made a small function that checks the active HAL pin against the widget every time the encoder signals, but your method is much more elegant.

New question: how to connect a button to a HAL pin? I want to add an MPG on/off button. I created a HAL pin in the handler file and created IndicatedPushButton. In the button properties, I added HAL.set_p(’mpg.mpg-enable’,’1’) to true_python_cmd_string. But I got an error:

  File "<string>", line 1
    HAL.set_p(’mpg.mpg-enable’,’1’)
              ^
SyntaxError: invalid character '’' (U+2019)

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

More
07 Dec 2025 03:30 #339808 by cmorley
Replied by cmorley on topic qtdragon mod
you could use a PushButton (under the linuxcnc-HAL heading)

It makes a hal pin.
Don't forget to set the property:
pin_name and pin_type
The following user(s) said Thank You: Mr. Mass

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

  • Mr. Mass
  • Mr. Mass's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 Feb 2026 19:07 #342811 by Mr. Mass
Replied by Mr. Mass on topic qtdragon mod
Finished the mod for qtdragon, which adds HAL pin encoders for all sliders, jog on all axes, increments, and MPG.

Add HAL pins for XYZABC axis jog:

qtdragon.jog.axis.x.plus
qtdragon.jog.axis.x.minus
qtdragon.jog.axis.y.plus
qtdragon.jog.axis.y.minus
qtdragon.jog.axis.z.plus
qtdragon.jog.axis.z.minus
qtdragon.jog.axis.a.plus
qtdragon.jog.axis.a.minus
qtdragon.jog.axis.b.plus
qtdragon.jog.axis.b.minus
qtdragon.jog.axis.c.plus
qtdragon.jog.axis.c.minus

For example, following pins are available for feedrate slider:

qtdragon.feed.override.count-enable = HAL_BIT, IN must be TRUE to enable feedrate counts
qtdragon.feed.override.counts = HAL_S32, IN encoder input for change feed override
qtdragon.feed.override.btn-100 = HAL_BIT, IN reset to feed override to 100%
qtdragon.feed.override.step = HAL_S32, IN increase/decrease step as a % of the maximum value

For sliders JOG_RATE and ANGULAR_JOG add pins to toggle between fast and slow jogging:

qtdragon.jog.override-linear.turtle = HAL_BIT IN decrease jogging in 10 times
qtdragon.jog.override-linear.turtle-led = HAL_BIT, OUT indicated slow mode is on
qtdragon.jog.override-angular.turtle = HAL_BIT IN decrease angular jogging in 10 times
qtdragon.jog.override-angular.turtle-led = HAL_BIT, OUT indicated angular jogging slow mode is on

Add HAL pins for MPG:

qtdragon.mpg.mpg-enable = HAL_BIT, IN must be TRUE to enable MPG counts

Jog increments pins, used first 3 INCREMENTS from ini file:
qtdragon.mpg.mpg-inc.1 = HAL_BIT, IN
qtdragon.mpg.mpg-inc.2 = HAL_BIT, IN
qtdragon.mpg.mpg-inc.3 = HAL_BIT, IN

For angular axis used next pins, also first 3 value from ini:
qtdragon.mpg.mpg-angular-inc.1 = HAL_BIT, IN
qtdragon.mpg.mpg-angular-inc.2 = HAL_BIT, IN
qtdragon.mpg.mpg-angular-inc.3 = HAL_BIT, IN

Pins for axis selected:
qtdragon.mpg.axis.x = HAL_BIT, IN
qtdragon.mpg.axis.y = HAL_BIT, IN
qtdragon.mpg.axis.z = HAL_BIT, IN
qtdragon.mpg.axis.a = HAL_BIT, IN
qtdragon.mpg.axis.b = HAL_BIT, IN
qtdragon.mpg.axis.c = HAL_BIT, IN

MPG encoder pin:

qtdragon.mpg.encoder-count = HAL_S32, IN MPG encoder input

Add a pins to cycle change increments:
qtdragon.mpg.mpg-inc.cycle = HAL_BIT, IN
qtdragon.mpg.mpg-angular-inc.cycle = HAL_BIT, IN

Put this file into <YOUR CONFIG FOLDER>/qtvcp/screens/qtdragon_hd/. Tested on qtdragon_hd, but should be working on qtdragon too.
Attachments:
The following user(s) said Thank You: COFHAL

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

More
16 Feb 2026 20:34 #343069 by COFHAL
Replied by COFHAL on topic qtdragon mod
I copied your file to the Screens folder, ran LCN, but no additional PINs appear in Show HAL. What am I doing wrong?

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

More
17 Feb 2026 06:10 #343080 by cmorley
Replied by cmorley on topic qtdragon mod
Did you try this?
Look for the heading : 2.8.2. Handler Patching - Subclassing Builtin Screens
linuxcnc.org/docs/stable/html/gui/qtvcp....cp:modifying-screens

Look for the direction on handler file placement.

Running linuxcnc from the terminal can give more info too.
The following user(s) said Thank You: COFHAL

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

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