pyvcp LED probably bug

More
18 Jan 2014 17:57 #42964 by eslavko
Hello...

During configuration of my machine I found probably bugg in pyvcp led.
Actualy in <disable_pin>.
This code:
<led>
    <halpin>"probe-led"</halpin>
    <disable_pin>"probe-led-disable"</disable_pin>
    <size>"28"</size>
    <on_color>"green"</on_color>
    <off_color>"red4"</off_color>
    <disable_color>"black"</disable_color>
</led>

should export pyvcp.probe-led-disable but does export pyvcp.probe-led.disable
just change the '-' with '.'

but the code:
<led>
    <halpin>"probe-led"</halpin>
    <disable_pin>"disable-led-signal"</disable_pin>
    <size>"28"</size>
    <on_color>"green"</on_color>
    <off_color>"red4"</off_color>
    <disable_color>"black"</disable_color>
</led>

should export pyvcp.disable-led-signal but does export pyvcp.probe-led.disable

semms that if <disable_pin>"any-text"</disable_pin> is present they export pin as <halpin>.disable instead the pinname written in <disable_pin>

...I got some grey hairs when finding why panel doesn't load caused by this.

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

More
18 Jan 2014 19:02 #42966 by ArcEye
Replied by ArcEye on topic pyvcp LED probably bug
Hi

It is not a bug, just a misunderstanding of what should be in that field.

The <disable_pin> field takes True/False or 1 / 0 not a name for the pin
The name for the pin is hard coded
class pyvcp_led(Canvas):
    """ (indicator) a LED 
        <led>
            <on_color>"colorname"</on_color>             Default color red
            <off_color>"colorname"</off_color>           Default color green

            <disable_pin>True</disable_pin>               Optional halpin sets led to disable_color

            <disable_color>"colorname"</disable_color>   Default color gray80
        </led>"""
    n=0
    def __init__(self,master,pycomp, halpin=None,disable_pin=False,     
                    off_color="red",on_color="green",disabled_color="gray80",size=20,**kw):
        Canvas.__init__(self,master,width=size,height=size,bd=0)
        self.off_color=off_color
        self.on_color=on_color
        self.disabled_color=disabled_color
        self.disable_pin = disable_pin
        self.oh=self.create_oval(1,1,size,size)
        self.state = 0
        self.itemconfig(self.oh,fill=off_color)
        if halpin == None:
            halpin = "led."+str(pyvcp_led.n) 
            pyvcp_led.n+=1
        self.halpin=halpin
        pycomp.newpin(halpin, HAL_BIT, HAL_IN)
        if disable_pin:
            halpin_disable = halpin+".disable"
            self.halpin_disable = halpin_disable
            pycomp.newpin(halpin_disable, HAL_BIT, HAL_IN)

regards
The following user(s) said Thank You: eslavko

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

More
18 Jan 2014 19:29 #42967 by eslavko
Replied by eslavko on topic pyvcp LED probably bug
Thanks...

(strange that no errors are thrown)

Slavko

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

More
18 Jan 2014 19:39 #42968 by ArcEye
Replied by ArcEye on topic pyvcp LED probably bug

(strange that no errors are thrown)


One of the reasons I don't like python, the field types are not declared, I suspect they are some type of variant type.

If you enter a string into a variant and then test it as a bool, do you get true or false? :side:

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

Time to create page: 0.618 seconds
Powered by Kunena Forum