How to use the spindle-cmd-rpm signal?

More
15 Nov 2017 14:36 #101832 by nicokid
Hi,
I'm playing with spindle speed and I would like to create a manual speed control in pyvcp and gladevcp.
Unfortunately if bypassing the spindle-cmd-rpm signal then the manual command from gladevcp works but mdi command stops working (eg M3 S20000).
That's what I did:

In my-mill.hal
net my-spindlespeed-mux => mux2.0.sel
net spindle-cmd-rpm => mux2.0.in1
net spindlespeed <= mux2.0.out => pwmgen.0.value

What I removed:
net spindle-cmd-rpm => pwmgen.0.value

In postgui.hal
net gvcp-spindlespeed <= gladevcp.scale_spindle_speed => mux2.0.in0

mux2.0.sel is always false and therefore spindle-cmd-rpm that is linked to in1 never works. I do not know how to set mux2.0.sel when I'm in mdi mode.
Any help?
Thanks, Nicola.

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

More
16 Nov 2017 04:55 #101876 by cmorley
you could use HALUI to select on MDI:
halui.mode.is-mdi
will be true on MDi.

But If your using gladevcp you could use a button to invoke an MDI command to start the spindle:
linuxcnc.org/docs/2.7/html/gui/gladevcp....mand_on_button_press

or use a button to invoke a python script to start the spindle:
linuxcnc.org/docs/2.7/html/gui/gladevcp....gladevcp:programming

It's more to learn in the beginning but really opens up what you can do.
Chris M

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

More
17 Nov 2017 09:16 #101920 by nicokid
Hello Chris, thanks for your reply.

you could use HALUI to select on MDI:
halui.mode.is-mdi
will be true on MDi.

Great, this works:
net net my-spindlespeed-mux <= halui.mode.is-mdi => mux2.%d.sel
net spindle-cmd-rpm => mux2.0.in1
net spindlespeed <= mux2.0.out => pwmgen.0.value

This is fine if you do not load a file. But if I load a file, my slider (for set rpm speed) continues to have precedence over the M3 S20000 command. This is not fine.

But If your using gladevcp you could use a button to invoke an MDI command to start the spindle:
linuxcnc.org/docs/2.7/html/gui/gladevcp....mand_on_button_press

or use a button to invoke a python script to start the spindle:
linuxcnc.org/docs/2.7/html/gui/gladevcp....gladevcp:programming

It's more to learn in the beginning but really opens up what you can do.
Chris M

This is interesting but you always have to press a button not just move the slider. It is not very user friendly.
I played a bit with python + gladevcp but I still have no great advantages over mdi_commands.

Thanks,
Nicola.

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

More
17 Nov 2017 12:18 #101925 by cmorley
If you load a file linuxcnc switches to auto mode but AXIS may switch back to MDI - use the status program to see what mode is currently running. Then you can try to cobble together some logic to work around the problem.

You can use the slider to invoke a python script too.
With python code you can do almost anything - this is how Gmoccapy and Gscreen interact with linuxcnc.
They are essentially just a non-standardly loaded gladevcp panel.

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

More
20 Nov 2017 09:51 - 20 Nov 2017 09:52 #102052 by nicokid

If you load a file linuxcnc switches to auto mode but AXIS may switch back to MDI - use the status program to see what mode is currently running. Then you can try to cobble together some logic to work around the problem.

Another interesting pin...
I joined things together and it seems that the system works.
In my-mill.hal:
setp lut5.0.function 0x1
net my-spindlespeed-is-mdi <= halui.mode.is-mdi => lut5.0.in-0
net my-spindlespeed-is-auto <= halui.mode.is-auto => lut5.0.in-1
net my-spindlespeed-lut <= lut5.0.out => mux2.0.sel
net spindle-cmd-rpm => mux2.0.in0
net spindlespeed <= mux2.0.out => pwmgen.0.value

In postgui.hal:
net gvcp-spindlespeed <= gladevcp.scale_spindle_speed => mux2.0.in1

You can use the slider to invoke a python script too.
With python code you can do almost anything - this is how Gmoccapy and Gscreen interact with linuxcnc.
They are essentially just a non-standardly loaded gladevcp panel.

I like python. What worries me is having to handle hal pin both in hal files and in python scripts. Anyway, I'm sure I will try to play.
Thank you.

Nicola.
Last edit: 20 Nov 2017 09:52 by nicokid.

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

More
24 Nov 2017 17:31 #102298 by andypugh
I have a better idea ;-)
Use motion.spindle-on to control the mux.

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

More
11 Dec 2017 23:35 #102954 by nicokid
I'm not sure it's better:
If I use motion.spindle-on to control the mux (mux2.0.sel) I will always have the slider running also when I'm in auto mode.
if I understand what you mean...

Nicola.

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

Time to create page: 0.114 seconds
Powered by Kunena Forum