how to hook up a second signal to

More
27 Apr 2020 15:21 - 27 Apr 2020 15:21 #165836 by CNCFred
Dear all, I proudly present easy things I manged myself:
hooked up a xbox one controller

created a subroutine (for crosslaser offset) move torch.

hooked up the custom button in plasmac extra to the subroutine and a button from the xbox controller

hooked up buttons from xbox controller to mdi-commands LaserON, LaserOFF

now comes the difficult part for me, I would like to use the hat to move the x and y axis

plasmathc.hal:net jog-x-pos halui.axis.x.plus
plasmathc.hal:net jog-x-neg halui.axis.x.minus

plasmathc.hal:net jog-y-pos halui.axis.y.plus
plasmathc.hal:net jog-y-neg halui.axis.y.minus


plasmathc.hal:net jog-z-pos halui.axis.z.plus
plasmathc.hal:net jog-z-neg halui.axis.z.minus


my plasmathc.hal part for the controller looks like:

#setup xbox controller
loadusr -W hal_input -KRAL Microsoft

#for midi and subroutine part in postgui.hal
net xbox-a <= input.0.btn-a
net xbox-b <= input.0.btn-b
net xbox-x <= input.0.btn-x
net xbox-y <= input.0.btn-y
#jog with hat
net xbox-hat-r halui.jog-x-pos <= input.0.abs-hat0x-is-pos
net xbox-hat-l halui.axis.x.minus <= input.0.abs-hat0x-is-neg

net xbox-hat-up halui.axis.y.plus <= input.0.abs-hat0y-is-neg
net xbox-hat-down halui.axis.y.minus <= input.0.abs-hat0y-is-pos

the above fails of course claiming signal is already hooke on. do I need an OR in order to hook up two signals? where do I put those in?

and i would like to use two buttons to change the jog-speed to low and fast again.:blush: no clue how to get the values in.

thank you very much for your help again and again and.....
Last edit: 27 Apr 2020 15:21 by CNCFred.

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

More
27 Apr 2020 18:08 #165849 by CNCFred
am I right that I have to unhook the axis first and feed it in the postgui into an or ?

which would mean
remove net jog-x-pos from the main hal file ?

and make a postgui with

loadrt or2
addf or2.0 servo-thread
net xbox-hat-r or2.0.in0 <=input.0.abs-hat0x-is-pos
net systemXplus or2.0.in1 <= halui.axis.x.plus
net hal.jog-x-pos <= or2.0.out

??this is very difficult... for me :-)

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

More
27 Apr 2020 19:12 #165858 by rodw
Very adventurous Fred.

You can use unlinkp to unlink a signal

eg
unlinkp jog-x-pos

That means you don't break anything.

do this in your plasmac connections hal file or perhaps in a new hal file altogether which needs to be loaded in your ini file. the same way the others are now.

If you need to unlink a screen variable, you need to uses a postgui file and it has a different command to load it in the in infile. See the ini file docs. I had to read up on that yesterday :)
The following user(s) said Thank You: CNCFred

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

More
27 Apr 2020 19:27 - 27 Apr 2020 19:28 #165860 by CNCFred
This is so cool.. As soon as I think I got it.... It's getting more complicated :-)
Thank you Rodw!
Last edit: 27 Apr 2020 19:28 by CNCFred.
The following user(s) said Thank You: rodw

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

More
28 Apr 2020 16:10 #165991 by CNCFred
ok reading done still struggling.

Can I use in a subroutine
setp halui.jog-speed 10 ??? to pass on parameters?

I think I need to use
halui.jog.<n>.plus instead of hal.jog-x-pos (only an example) so this is free and not hooked up?

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

More
29 Apr 2020 09:53 #166064 by rodw
setp is used to set a pin to a specific value if its not going to change. Maybe its a calibration number.

There are several ways to configure pins in hal and some of them are confusing. But my rule is to think of a signal as being a piece of wire. You can't connect a pin twice as it can only accept one wire. But you can connect the same wire to many pins

so I do this
net mysig <= mycomp.0.out
net mysig  => mycomp.1.in
net mysig => spindle.0.on

So the => and <= are optional but make it more readable
So the first line creates a signal name called mysig.
So the next two lines connect that signal (or wire) to two other components.
I think this is much easier to read and maintain.

Some people fold the first two lines in to one as shown below but I never do that. It just makes things harder.
net mysig  mycomp.1.in <= mycomp.0.out

THe last couple of days, I've been cursing PhillC as I hack fairly deeply into Plasmac for not doing it the way I suggest. For the most part, I can use unlinkp and leave the system hal files untouched which will make my custom work easier to maintain
But there is one pin I could not do that for some reason so I had to edit one of the screen handling
The following user(s) said Thank You: CNCFred

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

More
29 Apr 2020 10:14 - 29 Apr 2020 10:26 #166069 by CNCFred
to give feedback , I kept it stupid simple
used qjoypad to setup the controller so I didn't need to unlink and break etc.

but brought me further in understanding mux4 :-) and/or as well.

I intended to set the jog speed by extra button and button of the xbox controller
I thought if that could be done by subroutine it would be the easiest since they can be called......

second I found out that the move of axis using the controller is as well same situation to break add or/and and
at the end I find that not worth breaking a working system.


since they are all linked it is only possible with unlink and / or the mux and doing own hal as rodw suggested.

at least I created a own xbox.hal and added the pins to run the subroutinge G code for crosslaser on / off and the offset move.

thanks RODW for explaining again
net

thank you
Last edit: 29 Apr 2020 10:26 by CNCFred.
The following user(s) said Thank You: rodw

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

More
29 Apr 2020 10:39 #166080 by rodw
I wish more people would be adventurous like you and gather the courage to get down and dirty in hal files. They would be able to get so much done to improve their life.
The following user(s) said Thank You: CNCFred

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

More
29 Apr 2020 15:39 #166098 by CNCFred

Some people fold the first two lines in to one as shown below but I never do that. It just makes things harder.
net mysig mycomp.1.in <= mycomp.0.out


I can only strong agree....
The following user(s) said Thank You: Mike_Eitel

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

More
29 Apr 2020 19:22 - 29 Apr 2020 19:28 #166130 by bbsr_5a
i personly hard advice to use POSTGUI files to setup joypads not in the main HAL file
if the USB joypad gets EMI it will shut down the System but not the movementof the interpreter
if you are lucky the part will be finished without the Perifery of the system Mouse screen Keyboard Joypad doing anything

THIS CAN Happen
the Postgui is separeted to the base Hal system
i added my xbox joypad hal file
Attachments:
Last edit: 29 Apr 2020 19:28 by bbsr_5a. Reason: hal file
The following user(s) said Thank You: CNCFred

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

Moderators: snowgoer540
Time to create page: 0.135 seconds
Powered by Kunena Forum