Extra halpins for Touchy

More
13 Oct 2017 09:00 - 13 Oct 2017 09:02 #100317 by Ozzyrob
Ozzyrob created the topic: Extra halpins for Touchy
Due to not having a touch screen and wanting a pendant &/or control that interacts with the toggle buttons on the touchy interface I've come up with these few snippets. I have no python experience, so I think I need some advice on the best way to attack this. Or am I barking up the wrong tree. The idea is to have a pendant closer to the machine or a control panel with buttons.


Create new halpins
    self.c.newpin("select.fo", hal.HAL_BIT, hal.HAL_IN)
    self.selectfo = 0

Logic for halpin, just sends and activate signal to the button callback
        selectfo = self.c["select.fo"]
        if selectfo and not self.selectfo: 
            wfo = wtree.get_widget("fo")
            if wfo:
                os = wfo.get_active()
                if not os:
                    wfo.set_active(True) 
        self.selectfo = selectfo

So I can run touchy (in sim mode), use halcmd to send signals to the pins and the buttons seem to do their thing. There is a few changes in other areas I've had to make.
Last Edit: 13 Oct 2017 09:02 by Ozzyrob.
More
13 Oct 2017 13:13 - 13 Oct 2017 13:14 #100325 by andypugh
andypugh replied the topic: Extra halpins for Touchy
Using Touchy without a Touchscreen seems _slightly_ eccentric...

Touchscreens have become reasonably affordable now. It might be worth considering getting one.

However, I will be making similar changes to my own Touchy in the future as I want to be able to set jog speed with a knob.

I have already modified the FO and SO buttons to echo what the Halui inputs set. That might actually work better for you, switch count-enable in HAL and direct the jogwheel counts where needed.

I probably ought to discuss putting that change into the released version.
Last Edit: 13 Oct 2017 13:14 by andypugh.
More
13 Oct 2017 21:56 #100335 by Ozzyrob
Ozzyrob replied the topic: Extra halpins for Touchy
Eccentric.......rather a polite way of calling me a mad Aussie :laugh:

So far I'm only really interested in selecting a axis to jog and the scale. I threw the fo, mv & so pins in just to test the idea.

My logic is the halpin gets fired, the periodic function picks it up and then sends a signal off the the button, simulatig the button being clicked and the button's callback takes over from there. I didn't want to delve into the control logic of the main program. This seemed to be the easiest way to keep a switch press and widget in sync. Having a separate control knob hasn't been the idea. I only have a couple of hours under my belt with python.

The only change to touch.py I've had to make, from memory, is to add wTree to the call to periodic in hal_interface.py. All other changes have been made to hal_interface.py........I did this about 1:00am the the other morning so I might have made some other changes.

ATM code changes are more economically feasible than a touchscreen.
Time to create page: 0.063 seconds
Powered by Kunena Forum