2012/6/21, John Kasunich <jmkasun...@fastmail.fm>:
>
> On Thu, Jun 21, 2012, at 04:11 PM, Rando Sauvage wrote:
>
>> 2012/6/21, John Kasunich <jmkasun...@fastmail.fm>:
>> >
>> > On Thu, Jun 21, 2012, at 02:19 PM, Rando Sauvage wrote:
>> >
>> >> I have tried to do a logical "OR" with hal components in my custom.hal
>> >> file, but it doesn't works since my "emc_pause" script doesn't address
>> >> a real "pin" anymore ...
>> >>
>> >> loadrt or2 count=1
>> >> addf or2.0 servo-thread
>> >>
>> >> net programPause => halui.program.pause
>> >>
>> >> net pause-joystick or2.0.in0 <= input.0.btn-thumb
>> >> net pause-console or2.0.in1
>> >> net programPause <= or2.0.out
>> >>
>> >> I have then modified my emc_pause script as follow:
>> >> "halcmd setp pause-console 1;"
>> >> But it fails with this error: "<commandline>:0: parameter or pin
>> >> 'pause-console' not found", because pause-console is a signal name
>> >> with no pin associated ...
>> >
>> > As Andy has already pointed out, you could setp the input pin
>> > of the OR gate:
>> >   "halcmd setp or2.0.in1 1;"
>> >
>> > You could also retain the readability benefits of the named
>> > signal by using the "sets" command, which lets you set a signal
>> > instead of a pin:
>> >   "halcmd sets pause-console 1;"
>> >
>> > --
>> >   John Kasunich
>> >   jmkasun...@fastmail.fm
>> >
>> Thanks both for your answers.
>>
>> I am quite sure I tried "halcmd setp or2.0.in1 1;" and it didn't work
>> (it failed with a message "pin already in use" or something like
>> this).
>>
>> Wasn't aware of the existence of the "sets" command, great!
>>
>> I will get a try again in a couple of hours and let you know.
>>
>> Xavier
>>
>
> Oh, right - it won't let you set the pin because there is a signal
> connected to it.  If you delete the line "net pause-console or2.0.in1"
> then the pin would be free, and setp would work.  But personally
> I would keep the signal and use sets.  That way you have a nice
> readable signal name when you are studying the HAL file five
> years from now.
>

You know what ? You are 100% right here ! I have tested the 2
solutions, and yes, both work.

To sum-up the two solutions:
1) *** using setp ***

- custom.hal contains:
loadrt or2 count=1
addf or2.0 servo-thread
net programPause => halui.program.pause
net pause-joystick or2.0.in0 <= input.0.btn-thumb
net programPause <= or2.0.out

- and my emc_pause script is modified as follow (we address directly
the second input of the OR gate):
#!/bin/sh
halcmd setp or2.0.in1 1;
sleep 0.1
halcmd setp or2.0.in1 0;
sleep 1
halcmd setp halui.spindle.stop 1;
sleep 0.1
halcmd setp halui.spindle.stop 0;
halcmd setp halui.flood.off 1;
sleep 0.1
halcmd setp halui.flood.off 0;
echo Machine paused.


2) *** better solution: use sets (set signal) ***

- custom.hal contains:
loadrt or2 count=1
addf or2.0 servo-thread
net programPause => halui.program.pause

net pause-joystick or2.0.in0 <= input.0.btn-thumb
net pause-console or2.0.in1
net programPause <= or2.0.out

- and the beginning of my emc_pause script is modified as follow (this
time we address the signal that is connected to one of the input of
the OR gate):
#!/bin/sh
halcmd sets pause-console 1;
sleep 0.1
halcmd sets pause-console 0;
sleep 1
...

Obviously, I did the same for the emc_resume script / button. The only
difference is that we declare two OR gates (loadrt or2 count=2) and
the second one is addressed with the name "or2.1".

Note for those who are looking for more info: the html documentation
doesn't contain all the commands (eg I think that sets is missing), so
take a look at the man page of halcmd ("man halcmd").


Thanks again for your help :-)

Xavier

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to