How to connect hal pins to custom GUI?

More
1 year 11 months ago #314325 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.
Code:
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
Code:
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?

Please Log in to join the conversation.

More
1 year 11 months ago #314326 by Aciera
This is not correct syntax to connect two pins in hal:
Code:
net somePin hal_gpio.PIN33-in

Correct syntax is (<= and => are optional and are only to improve readability)
Code:
net some-signal-name <= hal_gpio.PIN33-in => somePin

Please Log in to join the conversation.

More
1 year 11 months ago #314327 by bladekel
I tried this but I got an error like
./my-mill.hal:57: Pin 'somePin' does not exist

Please Log in to join the conversation.

More
1 year 11 months ago #314334 by Aciera
use the 'show Halconfiguration' tool to find the correct pin name (something like 'qtplasmac.somePin')

Please Log in to join the conversation.

More
1 year 11 months ago #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

Please Log in to join the conversation.

More
1 year 11 months ago #314354 by phillc54

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.

Please Log in to join the conversation.

More
1 year 11 months ago #314365 by bladekel
This is the solution... Thanks....

Please Log in to join the conversation.

Time to create page: 0.170 seconds
Powered by Kunena Forum