Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Riddler on June 02, 2019, 04:41:41 PM

Title: Mach4, Esc key to stop program running
Post by: Riddler on June 02, 2019, 04:41:41 PM
How can Mach 4 be modified so the Esc key, when hit, will stop a program currently running? Like the old Mach 3 did. I tried mapping the Esc key in the keyboard inputs under plugins but I don't know what input to map the ESC key to on the Config-Inputs page to make it work. E-stop has to be mapped to Input#52 (the message that pops up if you do anything else)
Thanks
Scott
Title: Re: Mach4, Esc key to stop program running
Post by: joeaverage on June 02, 2019, 05:13:47 PM
Hi,
yes that can be done.

Daz's video shows the workaround:

https://www.machsupport.com/forum/index.php?topic=31585.0 (https://www.machsupport.com/forum/index.php?topic=31585.0)

Craig
Title: Re: Mach4, Esc key to stop program running
Post by: Riddler on June 09, 2019, 04:27:44 PM
It took me abit to get the correct code for a Estop. the help file and what is in the PCL Lua code is not 100% the same.
Here is the code "I" got to work.

if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT63)) == 1 then
   mc.mcCntlEStop(inst)
else
    --  Do something else
end

Scott
Title: Re: Mach4, Esc key to stop program running
Post by: joeaverage on June 10, 2019, 03:16:41 AM
Hi,
yes I can see how that code works, it has the advantage of simplicity but is woefully inefficient.

Mach is designed to use a signal library called SigLib in the screenload script. I wrote an introductory .pdf  about using
the signal library:
https://www.machsupport.com/forum/index.php?topic=40051.msg267764#msg267764 (https://www.machsupport.com/forum/index.php?topic=40051.msg267764#msg267764)

Craig