Modify HAL PIN from custom Gui

More
20 Apr 2015 05:07 #57914 by ww34ww34
Hi all!
I have a simple question.
I wanna link my X home pin to a "and2" HAL component to disable X hardware switch at runtime.

my <name>.hal changed from:
net min-home-x <= parport.0.pin-13-in-not

To:
net and-x0 and2.0.in0 <= parport.0.pin-13-in-not
net min-home-x <= and2.0.out

then i try to change value of the second "and2" PIN in the custom GUI:
def on_tbtn_unlock_x_toggled(self, widget, data=None):
        self.halcomp["and2.0.in1"] = widget.get_active()
I recive this error.
"AttributeError: Pin 'and2.0.in1' does not exist".

What I miss?
There is a better way to modify pin Value from custom GUI?

Regards Salvatore.
Thanks

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

More
20 Apr 2015 10:54 #57922 by cmorley
try:
def on_tbtn_unlock_x_toggled(self, widget, data=None):
	if widget.get_active():
    		self.halcomp.set_p('and2.0.in1',"true")


Chris M

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

More
20 Apr 2015 13:23 #57923 by ww34ww34
Thaks for fast reply.
No luck.

I recive

AttributeError: Pin 'set_p' does not exist

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

More
20 Apr 2015 20:16 #57937 by ww34ww34
Solved by myself.

The error was in the hal component definition:

I had
self.halcomp = hal.component("custom_gui_player")

Now i have
import hal      
....
self.halcomp = hal
And all work :-)

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

Time to create page: 0.095 seconds
Powered by Kunena Forum