Thanks for the reply Steve. Much appreciated.
I have tried the following
SigLib = {
[mc.OSIG_MACHINE_ENABLED] = function (state)
machEnabled = state;
ButtonEnable()
end,
[mc.ISIG_INPUT9] = function (S20ActivateCoolantPump)
local inst = mc.mcGetInstance();
local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON);
if(S20ActivateCoolantPump == 1) and (scr.IsLoaded()) then
mc.mcSignalSetState(hsig, 1);
mc.mcCntlSetLastError(inst, "Flood coolant is ON")
else
mc.mcSignalSetState(hsig, 0);
mc.mcCntlSetLastError(inst, "Flood coolant is OFF")
end
end,
}
Unfortunately, I have the same behavior as I said before.
During screen loading the output cycles on-off-0n-off
what makes things worse is if I use sth like
[mc.ISIG_INPUT12] = function (S32ServoAmplifierON) --S32 Servo Amplifier ON
if (S32ServoAmplifierON == 1) then
local inst = mc.mcGetInstance();
local reg = mc.mcSignalGetHandle(inst, mc.OSIG_MACHINE_ENABLED)
state = mc.mcSignalGetState(reg);
if(state == 1) then
state = 0
else
state = 1
end
mc.mcCntlEnable(inst, state)
end
then mach4 hangs and you must disconnect the ethernet connection to the controller and only then mach4 can restart.
What is really strange is, if mach 4 has finished loading, and you add the above code after loading, everything works as it should, until you restart and then during screen loading mach 4 hangs again.
Thank you all for your input.
Tasos