Please tell me why this will not work?
I am just trying to make my +Jog physical switch jog the X axis 1 inch when pressed IF the selector switch is in the X position (input 44 is on) and the Step Jog switch is set to x1 (input 19 is on). I am sure this should be and probably will be simple for a couple of you, but something so basic should not be so ridiculous to figure out. The switches are going through a Pokeys 57E and are registering properly with Pokeys Monitor (green when in position or pressed on, and white when not). I have the pokeys input pin number assigned to the same input number in the Mach4 settings.
[mc.ISIG_INPUT51] = function (state)
if(state == 1) then
local inst = mc.mcGetInstance()
local XSelected = mc.mcSignalGetHandle (inst, mc.ISIG_INPUT44)
local axSelX = mc.mcSignalGetState (XSelected)
local x1 = mc.mcSignalGetHandle (inst, mc.ISIG_INPUT19)
local jogSel = mc.mcSignalGetState (x1)
if (axSelX == 1) and (jogSel == 1) then
rc = mc.mcJogIncStart(inst,0,1)
end
end
end,
If I get rid of these lines then it will jog 1 inch, but this defeats what I need:
local inst = mc.mcGetInstance()
local XSelected = mc.mcSignalGetHandle (inst, mc.ISIG_INPUT44)
local axSelX = mc.mcSignalGetState (XSelected)
local x1 = mc.mcSignalGetHandle (inst, mc.ISIG_INPUT19)
local jogSel = mc.mcSignalGetState (x1)
if axSelX == 1 and jogSel == 1 then
Basically omitting the IF stuff where it does not check the other switches, then it will jog an inch. I just cannot get the If statements to work based on the input status of the other two switches no matter what I try so far.
One thing that is irritating is that you cannot use debug, it skips over these siglib and I just seem to get Nil values to show (when I have not created an error trying something).