On Mon, 18 Dec 2023 at 17:05, Alan Thomason via Emc-users
<emc-users@lists.sourceforge.net> wrote:

>  Is it possible to script in the initial file for the system to switch to 
> Machine ON (as long as there are no active limit switches).

Halui is a program that replicates many of the actions that are
otherwise handled in the GUI.
http://linuxcnc.org/docs/stable/html/man/man1/halui.1.html

In this case you would need to connect up the HAL pin halui.machine.on

Does your machine start up in the e-stop active or e-stop inactive
state? (This will depend on the wiring of the HAL e-stop loop) If it
does then you will also have to toggle the halui.estop.reset pin.
(And, having just checked, you can set them both at the same time, it
needs to be estop.reset then machine.on)

If the machine starts up in e-stop OFF then you probably just need a
single line in a postgui halfile
setp halui.machine.on 1

If you also need to reset the e-stop then it's a little more involved.
So, one way would be to set up a couple of cascaded one-shots in HAL,
then trigger them on the postgui halfile.

In the main (or custom) HAL:

loadrt oneshot names=estop-pulse,machine-on-pulse
addf estop-pulse servo-thread
addf machine-on-pulse
setp estop-pulse.rising 1
setp estop-pulse.falling 0
setp estop-pulse.width 1
setp machine-on-pulse.rising 0
setp machine-on-pulse.falling 1
setp machine-on-pulse.width 1
net e-reset estop-pulse.out  => halui.estop.reset  => machine-on-pulse.trigger
net on-signal machine-on-pulse.out => halui.machine.on

Then in the postgui HAL:

setp estop-pulse.trigger 1

The idea is that the postgui HAL first triggers a 1-second pulse to
estop-reset, then the falling edge of that pulse triggers the
machine-on.

It would also be possible to trigger machine-on directly from the
falling-edge of halui.estop.is-activated, but that would override the
normal ui functions (the machine would _always_ turn on when the
e-stop was released)  and you might not want that.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to