mist & flood buttons

More
06 Oct 2016 13:31 #81299 by Todd Zuercher
Replied by Todd Zuercher on topic mist & flood buttons
Ok, for starters I'd uncomment the mist and flood connection to the parallel port pins in your main hal file.
Then in your post gui hal do something like this:
# Include your customized HAL commands here
# The commands in this file are run after the AXIS GUI (including PyVCP panel) starts

sets spindle-at-speed true

loadrt toggle2nist names=toggle.0,toggle.1

addf toggle.0 servo-thread
addf toggle.1 servo-thread

######## Probe Led ########
net probe-in => pyvcp.probe-in

######## Mist Button ########
net mist-toggle toggle.0.in <= pyvcp.coolant-mist
net mist-on toggle.0.on => halui.mist.on
net mist-off toggle.0.off => halui.mist.off

######## Mist Led########
net mist-control halui.mist.is-on => toggle.0.is-on => pyvcp.mist.is-on

######## Air Button ########
net flood-toggle toggle.1.in <= pyvcp.coolant-flood
net flood-on toggle.1.on => halui.flood.on
net flood-off toggle.1.off => halui.flood.off

######## Air Led########
net flood-control halui.flood.is-on => toggle.1.is-on => pyvcp.flood.is-on

######## Panel Jogging Button ########
# connect the X pyVCP buttons
net my-jogxminus halui.jog.0.minus <= pyvcp.x-minus
net my-jogxplus halui.jog.0.plus <= pyvcp.x-plus

# connect the Y pyVCP buttons
net my-jogyminus halui.jog.1.minus <= pyvcp.y-minus
net my-jogyplus halui.jog.1.plus <= pyvcp.y-plus

# connect the Z pyVCP buttons
net my-jogzminus halui.jog.2.minus <= pyvcp.z-minus
net my-jogzplus halui.jog.2.plus <= pyvcp.z-plus

# connect the A pyVCP buttons
net my-jogaminus halui.jog.3.minus <= pyvcp.a-minus
net my-jogaplus halui.jog.3.plus <= pyvcp.a-plus

# connect the pyVCP jog speed slider
net my-jogspeed halui.jog-speed <= pyvcp.jog-speed-f

######## MDI Commands ########
net panel-cmd-00 halui.mdi-command-00 <= pyvcp.cmd-00
net panel-cmd-01 halui.mdi-command-01 <= pyvcp.cmd-01
net panel-cmd-02 halui.mdi-command-02 <= pyvcp.cmd-02
net panel-cmd-03 halui.mdi-command-03 <= pyvcp.cmd-03
net panel-cmd-04 halui.mdi-command-04 <= pyvcp.cmd-04
net panel-cmd-05 halui.mdi-command-05 <= pyvcp.cmd-05
net panel-cmd-06 halui.mdi-command-06 <= pyvcp.cmd-06
net remote-o100 halui.mdi-command-07 <= pyvcp.o100
net panel-cmd-08 halui.mdi-command-08 <= pyvcp.cmd-08
net panel-touch-x halui.mdi-command-09 <= pyvcp.touch-x
net panel-touch-y halui.mdi-command-10 <= pyvcp.touch-y
net panel-touch-z halui.mdi-command-11 <= pyvcp.touch-z
net panel-touch-a halui.mdi-command-12 <= pyvcp.touch-a
The following user(s) said Thank You: lucky phil, ikkuh

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

More
06 Oct 2016 13:46 #81301 by andypugh
Replied by andypugh on topic mist & flood buttons

I would like to use the panel buttons as I can simply click the mouse any time to operate, if I cant find a workaround or the exact code in the right place a three position switch might have to do.


There is no point hard-wiring it, my 3-way switches operate in HAL. However I have plenty of IO to interface them with.

You already have:
net coolant-mist => parport.0.pin-14-out
net coolant-flood => parport.0.pin-16-out

That creates two signals (coolant-mist, coolant-flood) and connects them to parport pins. Keep that but remove any other lines using those signals.

I have just remembered that the normal mux4 does not handle bit signals. This was probably your problem. We will use mux-generic.

Now, in the postGUI hal file (and after making sure that the postgui HAL file is mentioned in the [HAL] section of the INI file add this.
loadrt mux_generic config="bb4,bb4"

#This line prints out the actual names of the mux pins, just in case
show pin mux-*

addf mux-gen.00 servo-thread
addf mux-gen.01 servo-thread

net flood-manual-off pyvcp.flood-manual-off  =>  mux-gen.01.sel-bit-00
net flood-manual-on pyvcp.flood-manual-on => mux-gen.01.sel-bit-01
net mist-manual-off pyvcp.mist-manual-off  => mux-gen.01.sel-bit-00
net mist-manual-on pyvcp.mist-manual-on  =>mux-gen.01.sel-bit-01

net flood-auto iocontrol.0.coolant.flood =>  mux-gen.00.in-bit-00
setp mux-gen.00.in-bit-01 0
setp mux-gen.00.in-bit-01 1
setp mux-gen.00.in-bit-03 0
net coolant-flood <= mux-gen.00.out-bit

net mist-auto iocontrol.0.coolant.mist =>  mux-gen.01.in-bit-00
setp mux-gen.01.in-bit-01 0
setp mux-gen.01.in-bit-01 1
setp mux-gen.01.in-bit-03 0
net coolant-mist <= mux-gen.01.out-bit

I have not tested this, I am some distance from my LinuxCNC machine
The following user(s) said Thank You: lucky phil

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

More
06 Oct 2016 13:48 #81302 by andypugh
Replied by andypugh on topic mist & flood buttons
Now you have a choice of methods :-)

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

More
06 Oct 2016 20:08 #81310 by lucky phil
Replied by lucky phil on topic mist & flood buttons
Thanks guys
I would never have been able to code like that, I will check tonight after work or first thing Saturday morning and let you know how I go.
Philip

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

More
08 Oct 2016 13:10 #81405 by lucky phil
Replied by lucky phil on topic mist & flood buttons
Todd & Andy

Thankyou for your help.
I have used Todd's postgui.hal and both auto & manual switches work exactly how I want them too, I may have to put a debounce in because of the buttons on the mouse I'm using are a bit clicky sometimes.
I will try your code aswell Andy as I have another idea that I want to implement soon that would work well with an auto/off/on type setup.
Thanks again for your help.
Philip

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

Time to create page: 0.137 seconds
Powered by Kunena Forum