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.

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