How to connect hal pins to custom GUI?

More
12 Nov 2024 15:36 - 12 Nov 2024 15:39 #314325 by bladekel
How to connect hal pins to custom GUI? was created by bladekel
Hello to all.
I'm trying to build a custom GUI with pyqt5 for raspberryPi 5.
My linuxCNC version is 2.9.3, python version is 3.11.2.

I wanted to watch a input pin status whenever it changes.
I create a net in my hal file.
net somePin  hal_gpio.PIN33-in

After I created this net, I can see the pin and its changing logic from hal show with axis GUI.
I examined the qtplasmac_sim_handler.py and tried to make connections as on it.

Here is my custom GUI's handler file
def __init__(self, halcomp,widgets,paths):
    super().__init__()

    self.hal = halcomp self.somePinComp = self.hal.newpin('somePin', hal.HAL_BIT, hal.HAL_IN)
    self.somePinComp.value_changed.connect(lambda v: self.debugPrint("Changed"))

with this setup I cant see any changes. It only fires one time "Changed", and after that there is no information...

My guide qtplasmac_sim_handler.py did like I was...

What is my fault?
Last edit: 12 Nov 2024 15:39 by bladekel.

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

  • Aciera
  • Aciera's Avatar
  • Away
  • Administrator
  • Administrator
More
12 Nov 2024 15:43 #314326 by Aciera
Replied by Aciera on topic How to connect hal pins to custom GUI?
This is not correct syntax to connect two pins in hal:
net somePin  hal_gpio.PIN33-in

Correct syntax is (<= and => are optional and are only to improve readability)
net some-signal-name  <=  hal_gpio.PIN33-in => somePin
The following user(s) said Thank You: bladekel

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

More
12 Nov 2024 15:50 #314327 by bladekel
Replied by bladekel on topic How to connect hal pins to custom GUI?
I tried this but I got an error like
./my-mill.hal:57: Pin 'somePin' does not exist

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

  • Aciera
  • Aciera's Avatar
  • Away
  • Administrator
  • Administrator
More
12 Nov 2024 16:58 #314334 by Aciera
Replied by Aciera on topic How to connect hal pins to custom GUI?
use the 'show Halconfiguration' tool to find the correct pin name (something like 'qtplasmac.somePin')
The following user(s) said Thank You: bladekel

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

More
12 Nov 2024 21:52 - 12 Nov 2024 22:04 #314347 by JT
If you're creating a custom GUI have a look at Flex GUI as that is exactly what it's made for.

gnipsel.com/linuxcnc/flexgui/index.html

gnipsel.com/linuxcnc/flexgui/hal.html#label



JT
Last edit: 12 Nov 2024 22:04 by JT. Reason: add video
The following user(s) said Thank You: bladekel

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

More
13 Nov 2024 00:46 - 13 Nov 2024 00:47 #314354 by phillc54
Replied by phillc54 on topic How to connect hal pins to custom GUI?

I tried this but I got an error like
./my-mill.hal:57: Pin 'somePin' does not exist

You probably need the command in a postgui hal file as the pin won't exist until the gui is created.
Last edit: 13 Nov 2024 00:47 by phillc54.
The following user(s) said Thank You: bladekel

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

More
13 Nov 2024 05:17 #314365 by bladekel
Replied by bladekel on topic How to connect hal pins to custom GUI?
This is the solution... Thanks....

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

Time to create page: 0.060 seconds
Powered by Kunena Forum