- Posts: 52
- Thank you received: 0
How to use the spindle-cmd-rpm signal?
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 to join the conversation.
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 to join the conversation.
Great, this works:cmorley wrote: you could use HALUI to select on MDI:
halui.mode.is-mdi
will be true on MDi.
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.
This is interesting but you always have to press a button not just move the slider. It is not very user friendly.cmorley wrote: 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
I played a bit with python + gladevcp but I still have no great advantages over mdi_commands.
Thanks,
Nicola.
Please Log in to join the conversation.
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 to join the conversation.
Another interesting pin...cmorley wrote: 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.
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
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.cmorley wrote: 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.
Thank you.
Nicola.
Please Log in to join the conversation.
Use motion.spindle-on to control the mux.
Please Log in to join the conversation.
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 to join the conversation.
