Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: archerks on May 22, 2017, 03:08:26 AM

Title: How to use the keyboard ESC key to stop all movement.
Post by: archerks on May 22, 2017, 03:08:26 AM
The Feed Hold does work when I press the Space bar. Using it as an example I tried to make the Esc key do the stop function but it errors out on me. Below is the code...
Any suggestions will be greatly appreciated.

--this works for the Feed Hold
if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT63) == 1 then
     mc.mcCntlFeedHold (inst)
else
     --  Do something else
End

_________________________________________________________________

--This errors out
if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT623) == 1 then
     mc.mcCntlcycleStop (inst)
else
     --  Do something else
End
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: Fledermaus on May 22, 2017, 07:31:12 AM
Check your capitalisation in mcCntlCycleStop. Upper and lower case C look similar.

Allan
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: archerks on May 22, 2017, 11:21:01 AM
Thanks, but i do have with as mc.mcCntlCycleStop with the capital C's in the code I was trying. I just didn't get it right when I typed my question in the forum.
Dave
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: DazTheGas on May 22, 2017, 02:55:09 PM
Check your INPUT number mach4 doesnt have 623 inputs..

DazTheGas
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: archerks on May 22, 2017, 04:11:50 PM
Another error when entering message. The actual code does use input 62 not the 623 that I show above.
I have to learn to type more accurate and reread my messages.
Below is a copy and paste of what is in Mach4

if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT63)) == 1 then
    -- mcSignalWait(inst, ISIG_INPUT63, WAIT_MODE_Low, 0)
    mc.mcCntlFeedHold (inst)
else
    --   Do something else
end

--------------------------------------------------------------------------------------

--if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT62)) == 1 then
--    mc.mcCntlCycleStop (inst)
--else
--    --   Do something else
--end
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: Fledermaus on May 22, 2017, 06:02:30 PM
Why  are you showing the second section as  all commented  out? What code are you actually using?

Allan
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: archerks on May 22, 2017, 06:21:57 PM
The first one is for Feed Hold which works, the commented out one is for the stop which does not work when the comments are removed.
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: Fledermaus on May 23, 2017, 10:48:21 AM
OK.  I can't see a problem with the script itself. Let's go to the next step.

Have you set up an entry (or checked that one exists) in the Keyboard plugin and assigned this to Input 62 in Mach4's Input Signals tab?

Allan
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: archerks on May 23, 2017, 11:12:56 AM
Yes, they seem to be correct. Checked the keyboard inputs and Mach input signals.

Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: Chaoticone on May 23, 2017, 01:31:47 PM
Have you tested with some key other than esc. ?
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: DazTheGas on May 23, 2017, 03:05:53 PM
Try using the siglib in the Screen Load Scipt instead of the PLC as this works absolutely fine on my machine.

DazTheGas
Title: Re: How to use the keyboard ESC key to stop all movement.
Post by: Fledermaus on May 23, 2017, 03:14:15 PM
I suggest you substitute mc.mcCntlCycleStop (inst) for mc.mcCntlFeedHold (inst)
in the code for Input63. If this works then something must be mismatched in the Keyboard plugin / Input Signals area for Input62.

By the way, Daz is right, though either way should work .

Allan