- Posts: 863
- Thank you received: 240
Multiswitch component, one button multiple outputs
- ArcEye
- Topic Author
- Offline
- Platinum Member
-
This component just demonstrates a one button toggling switch as discussed in this thread.
Can be expanded for more outputs if required.
www.linuxcnc.org/index.php/english/compo...10&id=10272&start=12
regards
(see post 15809 for updated version)
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
-
- Posts: 3410
- Thank you received: 994
That is pretty neat! Should that comp be added to master?
John
Please Log in or Create an account to join the conversation.
- Rick G
- Offline
- Platinum Member
-
- Posts: 611
- Thank you received: 114
Cool, I will have to try that, I am running out of buttons on my joypad.
Rick G
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
- Posts: 19311
- Thank you received: 4655
This component just demonstrates a one button toggling switch as discussed in this thread.
Can be expanded for more outputs if required.
Can we make it take a modparam for number of outputs?
Give me an hour, I will make a version which does it that way for evaluation.
Please Log in or Create an account to join the conversation.
- ArcEye
- Topic Author
- Offline
- Platinum Member
-
- Posts: 863
- Thank you received: 240
Should that comp be added to master?
I have tested in simulation, setting the pins with halcmd and verifying it cycles and sets flags as it should.
It could do with a real world trial, if Rick is thinking of trying it, I can wait for any feedback first.
I will also wait to see what Andy comes up with, don't know if it is worth a modparam argv / argc type interface when there is only one settable param, but it would make it easier to use and more consistent with other components interfaces I suppose.
regards
Updated version of my offering with toggle set back to input here
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
- Posts: 19311
- Thank you received: 4655
[Give me an hour.
Make that three. I got distracted.
The only real advantage to doing it this way is that it supports up to 32 output bits.
It probably needs to support "names=" to be well-behaved component.
Please Log in or Create an account to join the conversation.
- ArcEye
- Topic Author
- Offline
- Platinum Member
-
- Posts: 863
- Thank you received: 240
Personalities and modparams are not something I have played with yet in .comp programming.
The components I have written have been either, only intended for use as singletons, or I have manually set params etc.
It didn't make complete sense until I expanded the macros and generated a C file.
You polish it and publish as your own, there is nothing in there of mine, save the concept, which is hardly unique.
regards
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
- Posts: 19311
- Thank you received: 4655
It didn't make complete sense until I expanded the macros and generated a C file.
Indeed. I am using at least two undocumented features there.
It is a pity that there is no way to omit "personality" from the auto-generated docs in cases where you are not using it (actually, it would also be nice to be able to alias "personality" to a modparam name of your choosing.
Please Log in or Create an account to join the conversation.
- fabworx
- Offline
- Senior Member
-
- Posts: 43
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- Rick G
- Offline
- Platinum Member
-
- Posts: 611
- Thank you received: 114
For example
loadrt or2 count=2
loads 2 or2 components.
Some good reading...
linuxcnc.org/docs/2.4/HAL_User_Manual.pdf
Rick G
Please Log in or Create an account to join the conversation.