HAL Newb, troubleshooting code that "Works-ish"

More
30 Jul 2014 05:56 #49276 by TroyO
I'm having some trouble with coding some things that shouldn't be too hard I don't think but I'm just not seeing what the issue is.

It's supposed to turn the spindle on/off but I can't do it like I did mist because halui.spindle.is_on doesn't exist, so I'm getting "Hack-ey" on it, LOL.

This code "works", either using the line that is commented out at the end or with the commented last couple of lines in place. The first way doesn't check machine on so it throws an error about not being able to activate spindle.stop while machine is off. (Assuming that you try it with machine off.... machine on is fine.)

The second way properly ignores the request when the machine is off, but when I launch LinuxCNC it "Hangs" for 40+ seconds and spins it's wheels before I can activate the power button. Once the button becomes available it works fine.

HAL Guru's, please advise, I swear I am searching diligently for answers before asking!


#Setup Safety Button##
net safety_button5 and2.6.in0 and2.8.in0 <= input.0.btn-top2
net machine_power_on and2.7.in0 and2.9.in0 and2.10.in0 <= halui.machine.is-on

#toggle coolant on and off Safety plus button6 and machine on
net button6 and2.6.in1 <= input.0.btn-pinkie
net cool_request and2.7.in1 <= and2.6.out
net tog_cool toggle.1.in <= and2.7.out
net togn_cool toggle2nist.0.in <= toggle.1.out
net cool_is_on toggle2nist.0.is-on <= halui.mist.is-on
net turn_mist_on halui.mist.on <= toggle2nist.0.on
net turn_mist_off halui.mist.off <= toggle2nist.0.off
net coolant-mist => pyvcp.coolant-mist

#Toggle Spindle on and off Safety plus button1
net button1 and2.8.in1 <= input.0.btn-joystick
net spindle_tog_request and2.9.in1 <= and2.8.out
net tog_spindle toggle.2.in <= and2.9.out
net spindle_on_tog halui.spindle.start not.0.in <= toggle.2.out

### this doesn't check for machine on but works. Throws error if active when machine is off#
###net spindle_off_ok halui.spindle.stop => not.0.out

###This holds the "power on" button hostage for ~40 seconds but works afterwards no error#
net spindle_off_tog and2.10.in1 <= not.0.out
net spindle_off_ok halui.spindle.stop <= and2.10.out

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

More
30 Jul 2014 14:53 #49282 by Rick G

It's supposed to turn the spindle on/off but I can't do it like I did mist because halui.spindle.is_on doesn't exist,



linuxcnc.org/docs/html/gui/halui.html
halui.spindle.is-on (bit, out) - indicates spindle is on (either direction)

Rick G
The following user(s) said Thank You: TroyO

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

More
30 Jul 2014 21:19 #49291 by TroyO
'Doh!

Well, that will do it, LOL.

I was using wiki.linuxcnc.org/cgi-bin/wiki.pl?Halui as my reference, which I guess is incomplete.

On the plus side.... I now have a glimmer of hope that I can get my head around this HAL thing in general, LOL.

Thanks for pointing me in the right direction! Sometimes figuring out which info is the most current is half the battle.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum