Hello Guest it is March 29, 2024, 10:32:26 AM

Author Topic: script for limit switch override  (Read 1688 times)

0 Members and 1 Guest are viewing this topic.

script for limit switch override
« on: January 02, 2018, 06:12:00 PM »
I am trying to write a lua function for turning on and off limit switch override. (I can provide more details as to why, but it's not important for this post)
I couldn't find anything in the core API help file that came with our copy of mach4.
Any help or suggestions would be great! 
Thanks,
David
Re: script for limit switch override
« Reply #1 on: January 02, 2018, 08:15:26 PM »
Hi,
if you have a look on the 'Edit Screen' page for the 'Axes Limit Override' button on the jogging tab it will list 'Limit OV On' as down action and 'Limit OV Off' as up action.
Note that these are both builtin functions, you can't see or edit the underlying code. All you can do is turn it on or off. Even if you were to write your own script
the built in functions will still be operative and may cause your script to fail.

Imagine the builtin OV function is Off then any limit switch activation will cause Mach to stop and disable according to its internal function. This would occurr even if
your script specified a different behaviour. In a sense the builtin function would operate in parallel to your script.

If you write a script and require that it determine the behaviour of the machine then the internal function must be in such a state that it does not override your function,
namely 'Axes Limit Override' = ON. Now the builtin Mach limit functions are inactive and you can determine the machine behavior with a script.

I would suggest that you monitor the limit switch inputs with entries in the signal script and on a limit event:
1) Ignore the event, ie your machine is in limit override mode  or
2) Issue a Feedhold and/or a Disable command and/or restrict jogging moves to those appropriate to recover from the over limit excusion.

Further I would suggest that this behavior be conferred to Mach at start up and remain throughout the session ie YOUR script is now the sole determinant in
machine behavior when a limit event is detected. This would include things like disabling axes or restricting jog moves to those neccessary to bring the machine
back into bounds rather than further away. Your script must therefor be complete and robust for it will assume an important protection function from Mach.
Are you ready to code such a script?

I have scanned the API and can find no instruction which sets the Limit Override status either. I will defer to other more experienced Lua programmers before I
claim that as fact however. Notwithstandind a direct API instruction it would still be possible to have a script assume limit event control of your machine.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: script for limit switch override
« Reply #2 on: January 03, 2018, 05:49:50 AM »
You might be able to use the built in functions via the existing button via the following LUA calls:

  rc = scr.ButtonDown("tbtnLimOv")
  rc = scr.ButtonUp("tbtnLimOv")

It would be as well to check that the above button name is correct.

Allan
Re: script for limit switch override
« Reply #3 on: January 04, 2018, 04:03:55 PM »
Thanks guys!! 
This gives me a lot to go on.