revisiting the multiswitch comp.

More
01 Oct 2013 08:40 #39426 by fabworx
it seems that the multiswitch comp has changed a little from version 2.5.0 to 2.5.3.

just so im clear on this with a cfg=2,3,2
you would have 3 multiswitches, multiswitch.0, and multiswitch.2 would have 2 toggles. am I correct in this line of thinking?
I cant find an example of how a complete hal should look with the multiswitch toggling through more then 2 parameters. I had this working in 2.5.0 but now that I have updated to 2.5.3 I cant get my hal to run without errors with the multiswitch.

this is how it was set up and it functioned fine.

loadrt multiswitch count=8
addf multiswitch.0 servo-thread #Step
setp multiswitch.0.positions 3
net step1 <= multiswitch.0.state0
net step2 or2.0.in0 <= multiswitch.0.state1
net step3 or2.1.in0 <= multiswitch.0.state2
net step4 or2.0.in1 or2.1.in1 <= multiswitch.0.state3
net toggle-step multiswitch.0.toggle <= hm2_5i20.0.gpio.061.in #Step

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

More
01 Oct 2013 14:50 #39435 by ArcEye
Hi

I was completely baffled at first, which is funny because I wrote the component you have been using. :laugh:

That component was never part of Linuxcnc, you must have downloaded it from the forum when I posted it.

It was rewritten in collaboration with Andy to use the same parameter types etc as other components, at which point it
went into Linuxcnc

You can either continue using the old one
www.linuxcnc.org/media/kunena/attachment...fa676a5c8f991dd.comp
Will just mean you need to compile it again with comp

Or switch to the new one which will be available in the same form throughout the versions
www.linuxcnc.org/docs/devel/html/man/man9/multiswitch.9.html

regards

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

More
02 Oct 2013 01:59 #39466 by fabworx
I changed it to the new version which took me a while to understand what was needed the man kinda sucks for an explanation an example would make it all make sense.

loadrt multiswitch cfg=3,2,3
addf multiswitch.0 servo-thread

net step1 multiswitch.0.bit_00
net step2 multiswitch.0.bit_01
net step3 multiswitch.0.bit_02

net button multiswitch.0.(down) hm2_5i20.0.gpio.61.in #or up which ever way you want that button to cycle through the bits just remove the parenthesis

addf multiswitch.1 servo-thread

net selectx multiswitch.1.bit_00
net selecty multiswitch.1.bit_01

net button multiswitch.1.(down) hm2_5i20.0.gpio.62.in #or up which ever way you want that button to cycle through the bits just remove the parenthesis

addf multiswitch.2 servo-thread

net function1 multiswitch.2.bit_00
net function2 multiswitch.2.bit_01
net function3 multiswitch.2.bit_02

net button multiswitch.2.(down) hm2_5i20.0.gpio.63.in #or up which ever way you want that button to cycle through the bits just remove the parenthesis

I wrote this as an example for others to see. This works for using one button to cycle though different functions.
The following user(s) said Thank You: ArcEye

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

More
02 Oct 2013 13:10 #39473 by ArcEye
Hi

The man pages are auto-generated from the header section of the comp file.
They generally are a bit terse, of course the programmer is intimately familiar
with its workings when it is produced and thinks it covers everything.
:laugh:
Thanks for the example.

Just to point out to others reading it, that the signals
step1/2/3
selectx/y
function1/2/3
still need to be connected to another pin to do something
and buttons would need unique names

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

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

More
02 Oct 2013 13:42 #39474 by fabworx
im not sure arceye, maybe you know. But if you setp the top position for a certain button, would that mean it is the default selection when linuxcnc is opened? im not sure of what the point of top position was.

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

More
02 Oct 2013 15:00 - 02 Oct 2013 16:54 #39475 by ArcEye
Hi

Having to re-familiarise myself, long time since I used it.

setp multiswitch.0.position 3 would set the current output to bit3

setp multiswitch.0.top_position 2 would restrict a 4 position switch which was declared, to 3 positions
Think of it like the spurred ring that you get on physical multi-position switches which drops into various holes and physically restricts the movement of the switch beyond a certain number of clicks.

There might be occassions where you would want to restrict access to whatever was connected to higher positions whilst a certain condition maintained, even though you declared those positions initially.

The other point which is not in the man page, so may not be obvious.
A lot of times you want a 'all-off' position at say position 0. Example might be a pendant with positions, OFF, X, Y, Z
Simply declare 1 more position than you have outputs and do not connect bit0 to anything.

regards
Last edit: 02 Oct 2013 16:54 by ArcEye.

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

Time to create page: 0.401 seconds
Powered by Kunena Forum