At the moment i'm implementing some Physical buttons for easier acces to some of my most used functions.
2 of them are Park and goto zero, both of the use an input signal from the button to run some g code.
Problem is that it's possible to press both buttons after each other which is no good news for my machine!
I've tried to solde this with an axisisstill api, but it's not working smoothly at the moment. If i press the button when the machine moves, it does what it's need to do (nothing + return error axis moving). But when i press the button when the machine is not moving, it starts whit a little yerk and moves into the correct spot. But it also returns the error "machine is moving"
I've already added a millisleep, to overcome this, but the problem persists.
Any idea howto implement this the correct way?
mc.ISIG_INPUT4 = Function (state) -- Park Button
local MotorIsStillX = mc.mcAxisIsStill (inst, 1)
local MotorIsStillXs = mc.mcAxisIsStill (inst, 3)
local MotorIsStillY = mc.mcAxisIsStill (inst, 0)
if (( state==1) and (MotorIsStillX == 1) and (MotorIsStillXs == 1) and (MotorIsStillY == 1)) then
wx.wxMillisleep (500)
local msg = " G00 G53 X3100 Y1200"
mc.mcCntlSetLastError(inst, "Goto Park")
mc.mcCntlGcodeExecute(inst, msg)
else
mc.mcCntlSetLastError (inst, "Machine is moving")
end
end,
Keep Safe & Best wishes for the year to come!
Adam