Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Brian Barker on May 03, 2014, 09:11:43 PM

Title: Signal Scripts
Post by: Brian Barker on May 03, 2014, 09:11:43 PM
Well Now that you guys have been having fun with scripts I wanted to share a fun one with you.

In the PLC script I have this:
Code: [Select]
SigLib = {
    --Enable
    [mc.OSIG_MACHINE_ENABLED] = function (state)
        machEnabled = state;
    end,
    --HeadUp
    [mc.ISIG_INPUT1] = function (on_off)--mc.ISIG_INPUT1
        if( on_off==1 ) then
            -- On
        else
            -- Off
        end
    end,
    --HeadDn
    [mc.ISIG_INPUT2] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            -- On
        else
            -- Off Call A function here if you wanted
        end
    end,
  [mc.ISIG_INPUT3] = function (state)--mc.ISIG_INPUT3 --Used as an enable button
        if( state == 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
    end,
    [mc.ISIG_INPUT4] = function (state)--mc.ISIG_INPUT2 button to do feed hold
        if( state == 1 ) then
            local inst= mc.mcGetInstance();
            mc.mcCntlFeedHold(inst)
        end
    end,
    [mc.ISIG_INPUT5] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            CycleStart() --Run my cycle start function
        end
    end
}

Then in the signal script I do this:
Code: [Select]
if(SigLib[sig] ~= nil)then
SigLib[sig](state);
end

The magic of this is your functions get called when the state changes on the input! So you can make inputs do things on your screen .. for example you could enable the control, Swap pages, do a cycle start, ANYTHING.. I use this in my screen to interface my PLC to the screen so I can have buttons do things on the screen.

Event based programing :) By adding the function calls to a Lua table the speed is very fast to jump into the index in the table.

Hope that helps you all to make your dream screen!

Thanks
Brian
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 08:12:01 AM
After adding and a restart I receive this Error message.

had to comment this out to get the enable button to work again.

--if(SigLib[sig] ~= nil)then
--SigLib[sig](state);
--end
Title: Re: Signal Scripts
Post by: Brian Barker on May 04, 2014, 08:49:44 AM
if you rem that out you will not call the signal table I made :)
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 08:52:49 AM
"had to comment this out to get the enable button to work again."

Nothing works if I dont rem them out
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 10:23:10 AM
Here is my complete Lua script
other than the rem lines, please enlighten me, what causes your Signal Script not to work for me?
when rem's are removed and restarted the error message shows.
The Green Disable button only flashes and does not visually change states when pressed.

This ability to see everything, is priceless, and think their file should be posted when having issues.

So that everyone knows; the "Lua Script" (found under the Operator Menu) has every script for everything in your selected running screen.set
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 12:34:03 PM
If I just change screen sets to one that does not have your script in it, I still have the same issue until I restart Mach4. Then the Enable/Disable buttons works correct again and the emulation keys work. Makes me think it is tied in to the machine.ini file too.
Title: Re: Signal Scripts
Post by: poppabear on May 04, 2014, 01:16:53 PM
That is because in:

if(SigLib[sig] ~= nil)then
SigLib[sig](state);
end

sig (that is in SigLib[sig]), needs to be replaces with the "Signal" your testing against, i.e.

sig = one of the following in this instance:

[mc.OSIG_MACHINE_ENABLED],
[mc.ISIG_INPUT1],
[mc.ISIG_INPUT2],
[mc.ISIG_INPUT3],           
[mc.ISIG_INPUT4],
or
[mc.ISIG_INPUT5]

Tables in lua are Key/value pairs, in this case the "Key" is your sig name, further the "Key" as used here is also a mc var as well so it is pulling double duty.

Scott

Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 01:43:35 PM

I see the sig and the state it is looking for,
Have keyboard emulation signal Input 5 setup as function key F2
Just cant get by the startup error to try it out for the cycle start button.
when the script is not running I can trigger the output led I created so I know that's working.

Title: Re: Signal Scripts
Post by: poppabear on May 04, 2014, 01:46:21 PM
post YOUR code, that you are running in the PLC script
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 01:57:32 PM
I posted everything above in the text file

but here is just the PLC script

Code: [Select]
local inst = mc.mcGetInstance();
local rc = 0;
testcount = testcount + 1
machState, rc = mc.mcCntlGetState(inst);
local inCycle = mc.mcCntlIsInCycle(inst);

--mc.mcCntlSetLastError(inst, 'machWasEnabled = ' .. tostring (machWasEnabled) .. 'machEnabled = ' .. tostring(machEnabled));

if ((machWasEnabled == 0) and (machEnabled == 1)) then
    --mc.mcCntlSetLastError(inst, 'Enable!');
    scr.SetProperty('btnEnable', 'Label', 'Disable');
    scr.SetProperty('btnEnable', 'Bg Color', '#FF0000');

    --Enable controls!
elseif ((machWasEnabled == 1) and (machEnabled == 0)) then
    --mc.mcCntlSetLastError(inst, 'Disable!');
    scr.SetProperty('btnEnable', 'Label', 'Enable');
    scr.SetProperty('btnEnable', 'Bg Color', '');

    --Diaable controls!
    scr.SetProperty('CycleStart', 'Enabled', '0');

    enableBlink = 0;
    enableBlinkCount = 0;
end

--Blink the enable button.
if (machEnabled == 0) then
    enableBlinkCount = enableBlinkCount + 1;
    --mc.mcCntlSetLastError(inst, 'enableBlinkCount = ' .. tostring(enableBlinkCount));
    if (enableBlinkCount == 10) then
        enableBlink = not enableBlink;
        --mc.mcCntlSetLastError(inst, 'enableBlink = ' .. tostring(enableBlink));
        if (enableBlink == true) then
            scr.SetProperty('btnEnable', 'Bg Color', '#00FF00');
        elseif(enableBlink == false) then
            scr.SetProperty('btnEnable', 'Bg Color', '');
        end
        enableBlinkCount = 0;
    end
end

if ((machState ~= machStateOld) or (machEnable ~= machWasEnabled)) then
    local enaCycleStart = ((machState == mc.MC_STATE_IDLE) or (machState == mc.MC_STATE_HOLD)
            or (machState == mc.MC_STATE_FRUN_PROBE_FH)
            or (machState == mc.MC_STATE_FRUN_THREAD_FH)
            or (machState == mc.MC_STATE_FRUN_MACROH)
            or (machState == mc.MC_STATE_MRUN_FH)
            or (machState == mc.MC_STATE_FRUN_FH)
            or (machState == mc.MC_STATE_MRUN_PROBE_FH)
            or (machState == mc.MC_STATE_MRUN_THREAD_FH)
            or (machState == mc.MC_STATE_MRUN_MACROH)
            or (machState == mc.MC_STATE_FRUN_SINGLE_BLOCK))
    enaCycleStart = (enaCycleStart and (machEnabled == 1))

    local enaStop = (machState ~= mc.MC_STATE_IDLE) and (machEnabled == 1) and (machState ~= mc.MC_STATE_JOG)
    local enaFeedHold = (machState ~= mc.MC_STATE_IDLE) and (machEnabled == 1) and (machState ~= mc.MC_STATE_JOG)
    local enaReset = (machEnabled == 1) and (machState == mc.MC_STATE_IDLE)
    local enaJog = ((machState == mc.MC_STATE_IDLE) or (machState == mc.MC_STATE_HOLD)
            or (machState == mc.MC_STATE_FRUN_PROBE_FH)
            or (machState == mc.MC_STATE_JOG)
            or (machState == mc.MC_STATE_FRUN_THREAD_FH)
            or (machState == mc.MC_STATE_FRUN_MACROH)
            or (machState == mc.MC_STATE_FRUN_MACROH_JOG)
            or (machState == mc.MC_STATE_MRUN_FH)
            or (machState == mc.MC_STATE_FRUN_FH)
            or (machState == mc.MC_STATE_MRUN_PROBE_FH)
            or (machState == mc.MC_STATE_MRUN_THREAD_FH)
            or (machState == mc.MC_STATE_FRUN_FH_JOG)
            or (machState == mc.MC_STATE_MRUN_MACROH)
            or (machState == mc.MC_STATE_MRUN_MACROH_JOG))
    enaJog = (enaJog and (machEnabled == 1))
   
    if (enaCycleStart) then
        scr.SetProperty('btnCycleStart', 'Enabled', '1');
    else
        scr.SetProperty('btnCycleStart', 'Enabled', '0');
    end

    if (enaStop) then
        scr.SetProperty('btnStop', 'Enabled', '1');
    else
        scr.SetProperty('btnStop', 'Enabled', '0');
    end

    if (enaFeedHold) then
        scr.SetProperty('btnFeedHold', 'Enabled', '1');
    else
        scr.SetProperty('btnFeedHold', 'Enabled', '0');
    end

    if (enaReset) then
        scr.SetProperty('btnReset', 'Enabled', '1');
    else
        scr.SetProperty('btnReset', 'Enabled', '0');
    end

--    if (enaJog) then
--        scr.SetProperty('pnlJog', 'Enabled', '1');
--        JogEnable();
--    else
--        scr.SetProperty('pnlJog', 'Enabled', '0');
--    end
end

if (machEnabled ~= machWasEnabled) then
    scr.SetProperty('btnRefAll', 'Enabled', tostring(machEnabled));
    scr.SetProperty('btnRefAll2', 'Enabled', tostring(machEnabled));
    scr.SetProperty('btnGotoZero', 'Enabled', tostring(machEnabled));
    scr.SetProperty('tabJogging', 'Enabled', tostring(machEnabled));
    if (machEnabled == 1) then
        AxisEnable();
    end
end

SigLib = {
    --Enable
    [mc.OSIG_MACHINE_ENABLED] = function (state)
        machEnabled = state;
    end,
    --HeadUp
    [mc.ISIG_INPUT1] = function (on_off)--mc.ISIG_INPUT1
        if( on_off==1 ) then
            -- On
        else
            -- Off
        end
    end,
    --HeadDn
    [mc.ISIG_INPUT2] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            -- On
        else
            -- Off Call A function here if you wanted
        end
    end,
  [mc.ISIG_INPUT3] = function (state)--mc.ISIG_INPUT3 --Used as an enable button
        if( state == 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
    end,
    [mc.ISIG_INPUT4] = function (state)--mc.ISIG_INPUT2 button to do feed hold
        if( state == 1 ) then
            local inst= mc.mcGetInstance();
            mc.mcCntlFeedHold(inst)
        end
    end,
    [mc.ISIG_INPUT5] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            CycleStart() --Run my cycle start function
        end
    end
}

--local CurrentLine = scr.GetProperty('droCurrent', 'Value', mc.mcCntlGetGcodeLineNbr);
local TotalLines = mc.mcCntlGetGcodeLineCount(inst);
local GcodeCurrentLine = mc.mcCntlGetGcodeLineNbr(inst);
local GcodePercent = (GcodeCurrentLine/TotalLines) * 100;

--scr.SetProperty('droCurrent', 'Value', tostring(CurrentLine));
scr.SetProperty('droTotal', 'Value', tostring(TotalLines+1));
scr.SetProperty('droPercent', 'Value', tostring(GcodePercent));

local Xval = mc.mcAxisGetPos(inst,0);
local Yval = mc.mcAxisGetPos(inst,1);
local Zval = mc.mcAxisGetPos(inst,2);

getAngle(Xval,Yval);
scr.SetProperty('droXY', 'Value', tostring(angle));
getAngle(Xval,Zval);
scr.SetProperty('droXZ', 'Value', tostring(angle));
getAngle(Yval,Zval);
scr.SetProperty('droYZ', 'Value', tostring(angle));

getHypot(Xval,Yval);
scr.SetProperty('droXYhyp', 'Value', tostring(Hyp));
getHypot(Xval,Zval);
scr.SetProperty('droXZhyp', 'Value', tostring(Hyp));
getHypot(Yval,Zval);
scr.SetProperty('droYZhyp', 'Value', tostring(Hyp));

--This is the last thing we do.  So keep it at the end of the script!
machStateOld = machState;
machWasEnabled = machEnabled;

Title: Re: Signal Scripts
Post by: poppabear on May 04, 2014, 02:08:50 PM
don't see where you put this:

if(SigLib[THE_SIGNAL_NAME] ~= nil)then
SigLib[THE_SIGNAL_NAME](state);
end

in there
Title: Re: Signal Scripts
Post by: poppabear on May 04, 2014, 02:18:36 PM
Notice also that, in Brian's PLC he defines "MachState", but I don't see where/if he has passed "MachState" to the Function(state) param....  it may be there, if so, I am just missing it...

scott
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 04, 2014, 02:27:01 PM
Quote
Brian had said put this script === Then in the signal script I do this:

ahh... based on that I need to pass the
sig = THE_SIGNAL_NAME_I_want_to_use;

I though sig was looking at all the inputs and just looking for the changing state
Title: Re: Signal Scripts
Post by: Brian Barker on May 04, 2014, 09:17:35 PM
I will try to test the example tomorrow. This is running on a machine at the shop, but I could have missed something... It happens!
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 10, 2014, 01:01:46 PM
with the latest version of mach4 this signal script works now, thanks


mc.mcCntlSetLastError(0, 'sig1 = ' .. tostring(sig));
mc.mcCntlSetLastError(0, 'state1 = ' .. tostring(state));
if (SigLib[sig] ~= nil) then
   SigLib[sig](state);
        mc.mcCntlSetLastError(0, 'sig2 = ' .. tostring(sig));
        mc.mcCntlSetLastError(0, 'state2 = ' .. tostring(state));
end

you can see what button signal number
and 0 for off 1 for on

Still trying to get my head around it but at least it seems to be giving me something useful.
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 10, 2014, 01:48:14 PM
I take that back, it works kind of,
only after you rem that section restart mach4 then take the rems marks out
then it works till you restart
so im getting closer but its not fully functional.


how do you display two or more variables on one line?
mc.mcCntlSetLastError(0, 'state  &  signal = ' .. tostring(state) "  " .. tostring(sig));
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 10, 2014, 02:26:01 PM
if I leave this one line in the signal script I can see what button number is being pushed,
just not sure what all the other numbers that get displayed with some button presses represent.

note: and only if a script is associated with that button.

 mc.mcCntlSetLastError(inst, 'signal = ' .. tostring(sig));
Title: Re: Signal Scripts
Post by: Brian Barker on May 10, 2014, 05:38:00 PM
I did an update to the Sig Lib it now is tested to be working and I made it simulate a tool release button .

SigLib = {
    [mc.ISIG_INPUT1] = function (state)
       
    end,
    --Tool Release Button
    [mc.ISIG_INPUT2] = function (state)--mc.ISIG_INPUT1
        local inst = mc.mcGetInstance();
        local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1);
       
        if( state==1 ) then
            --Check to see if the spindle is stopped here
            --Turn On Tool Release (Unclam Tool)
            mc.mcSignalSetState(hsig, 1 );
           
       else
           --Turn Off Tool Release (Clamp Tool)
            mc.mcSignalSetState(hsig, 0 );
        end
    end
}


You also need to have a signals script with this code

if(SigLib[sig] ~= nil)then
SigLib[sig](state);
end


Thanks
Brian
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 10, 2014, 11:40:28 PM
With the help of Illya and Brian

As an update for all, the script does not go into the PLC Script, it goes in the Screen Load Script.
works sweet now.

thanks guys


Code: [Select]
SigLib = {
   --Enable
    [mc.OSIG_MACHINE_ENABLED] = function (state)
        machEnabled = state;
    end,
    --HeadUp
    [mc.ISIG_INPUT1] = function (on_off)--mc.ISIG_INPUT1
        if( on_off==1 ) then
            -- On
        else
            -- Off
        end
    end,
    --HeadDn
    [mc.ISIG_INPUT2] = function (state)--mc.ISIG_INPUT2
        if( state == 1 ) then
            -- On
        else
            -- Off Call A function here if you wanted
        end
    end,
  [mc.ISIG_INPUT3] = function (state)--mc.ISIG_INPUT3 --Used as an enable button
        if( state == 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
    end,
    [mc.ISIG_INPUT4] = function (state)--mc.ISIG_INPUT2 button to do feed hold
        if( state == 1 ) then
            local inst= mc.mcGetInstance();
            mc.mcCntlFeedHold(inst)
        end
    end,
    [mc.ISIG_INPUT5] = function (state)--mc.ISIG_INPUT5
        if( state == 1 ) then
            CycleStart() --Run my cycle start function
        end
    end,
    [mc.ISIG_INPUT6] = function (state)--mc.ISIG_INPUT6
        local inst = mc.mcGetInstance();--Tool Release Button
        local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT7);
      
        if( state==1 ) then
            --Check to see if the spindle is stopped here
            --Turn On Tool Release (Unclam Tool)
            mc.mcSignalSetState(hsig, 1 );        
       else
           --Turn Off Tool Release (Clamp Tool)
            mc.mcSignalSetState(hsig, 0 );
        end
    end
}



this still goes in the signal script:
if(SigLib[sig] ~= nil)then
SigLib[sig](state);
end
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on May 11, 2014, 07:50:11 AM
Update to my question on combining (concant) variable to output on one line
I put this in the "Signal Script" and it displays the Key signal number and the button state.
more for informational use and testing then anything at this time.
Note; (to display one "&" you have to use two)
the ".." is the concant function
several button spew out several lines, view in history

mc.mcCntlSetLastError(inst, 'Signal && State = ' .. tostring(sig) .. ' && ' .. tostring(state));
Title: Re: Signal Scripts
Post by: Analias on July 20, 2014, 12:19:23 AM
I'm digging this signal handling trick. The code for updating UI elements based on signal state only has to happen when the signal is sent.  Makes the PLC script way easier to maintain. 

These are the kind of language "hacks" (meant in a really cool code way) that Lua supports that allows coders to be expressive. 


-Freeman
Title: Re: Signal Scripts
Post by: Analias on July 20, 2014, 12:42:50 AM
One thing I did notice, is if you add new signal handlers to your SigLib a restart of M4 is needed to pick them up.  You can change existing signal handlers without a restart though.

-Freeman
Title: Re: Signal Scripts
Post by: Ya-Nvr-No on July 20, 2014, 05:15:20 PM
Ya, I'm thinking mach4 has to read the machine.ini file to address the signal name correctly, thus the need for a restart. Hopefully these little details will be covered in the documentation.
Title: Re: Signal Scripts
Post by: Analias on July 23, 2014, 12:26:42 AM
Signals become very interesting when you have a real motion device behind it.  The simulator doesn't appear to implement any input signals (ISIG_*).

Now that I have moved my screen set with signal handling installed over to my Sieg X3, I start to see how things like homing scripts are simple to implement.

If you would like to save some typing and monitor your signals, add the following to the bottom of your screen signal script:

Code: [Select]
local sigNames = {
    [mc.ISIG_DIGITIZE] = 'ISIG_DIGITIZE',
    [mc.ISIG_EMERGENCY] = 'ISIG_EMERGENCY',
    [mc.ISIG_INDEX] = 'ISIG_INDEX',
    [mc.ISIG_INPUT_FINISH] = 'ISIG_INPUT_FINISH',
    [mc.ISIG_INPUT_START] = 'ISIG_INPUT_START',
    [mc.ISIG_INPUT0] = 'ISIG_INPUT0',
    [mc.ISIG_INPUT1] = 'ISIG_INPUT1',
    [mc.ISIG_INPUT10] = 'ISIG_INPUT10',
    [mc.ISIG_INPUT11] = 'ISIG_INPUT11',
    [mc.ISIG_INPUT12] = 'ISIG_INPUT12',
    [mc.ISIG_INPUT13] = 'ISIG_INPUT13',
    [mc.ISIG_INPUT14] = 'ISIG_INPUT14',
    [mc.ISIG_INPUT15] = 'ISIG_INPUT15',
    [mc.ISIG_INPUT16] = 'ISIG_INPUT16',
    [mc.ISIG_INPUT17] = 'ISIG_INPUT17',
    [mc.ISIG_INPUT18] = 'ISIG_INPUT18',
    [mc.ISIG_INPUT19] = 'ISIG_INPUT19',
    [mc.ISIG_INPUT2] = 'ISIG_INPUT2',
    [mc.ISIG_INPUT20] = 'ISIG_INPUT20',
    [mc.ISIG_INPUT21] = 'ISIG_INPUT21',
    [mc.ISIG_INPUT22] = 'ISIG_INPUT22',
    [mc.ISIG_INPUT23] = 'ISIG_INPUT23',
    [mc.ISIG_INPUT24] = 'ISIG_INPUT24',
    [mc.ISIG_INPUT25] = 'ISIG_INPUT25',
    [mc.ISIG_INPUT26] = 'ISIG_INPUT26',
    [mc.ISIG_INPUT27] = 'ISIG_INPUT27',
    [mc.ISIG_INPUT28] = 'ISIG_INPUT28',
    [mc.ISIG_INPUT29] = 'ISIG_INPUT29',
    [mc.ISIG_INPUT3] = 'ISIG_INPUT3',
    [mc.ISIG_INPUT30] = 'ISIG_INPUT30',
    [mc.ISIG_INPUT31] = 'ISIG_INPUT31',
    [mc.ISIG_INPUT32] = 'ISIG_INPUT32',
    [mc.ISIG_INPUT33] = 'ISIG_INPUT33',
    [mc.ISIG_INPUT34] = 'ISIG_INPUT34',
    [mc.ISIG_INPUT35] = 'ISIG_INPUT35',
    [mc.ISIG_INPUT36] = 'ISIG_INPUT36',
    [mc.ISIG_INPUT37] = 'ISIG_INPUT37',
    [mc.ISIG_INPUT38] = 'ISIG_INPUT38',
    [mc.ISIG_INPUT39] = 'ISIG_INPUT39',
    [mc.ISIG_INPUT4] = 'ISIG_INPUT4',
    [mc.ISIG_INPUT40] = 'ISIG_INPUT40',
    [mc.ISIG_INPUT41] = 'ISIG_INPUT41',
    [mc.ISIG_INPUT42] = 'ISIG_INPUT42',
    [mc.ISIG_INPUT43] = 'ISIG_INPUT43',
    [mc.ISIG_INPUT44] = 'ISIG_INPUT44',
    [mc.ISIG_INPUT45] = 'ISIG_INPUT45',
    [mc.ISIG_INPUT46] = 'ISIG_INPUT46',
    [mc.ISIG_INPUT47] = 'ISIG_INPUT47',
    [mc.ISIG_INPUT48] = 'ISIG_INPUT48',
    [mc.ISIG_INPUT49] = 'ISIG_INPUT49',
    [mc.ISIG_INPUT5] = 'ISIG_INPUT5',
    [mc.ISIG_INPUT50] = 'ISIG_INPUT50',
    [mc.ISIG_INPUT51] = 'ISIG_INPUT51',
    [mc.ISIG_INPUT52] = 'ISIG_INPUT52',
    [mc.ISIG_INPUT53] = 'ISIG_INPUT53',
    [mc.ISIG_INPUT54] = 'ISIG_INPUT54',
    [mc.ISIG_INPUT55] = 'ISIG_INPUT55',
    [mc.ISIG_INPUT56] = 'ISIG_INPUT56',
    [mc.ISIG_INPUT57] = 'ISIG_INPUT57',
    [mc.ISIG_INPUT58] = 'ISIG_INPUT58',
    [mc.ISIG_INPUT59] = 'ISIG_INPUT59',
    [mc.ISIG_INPUT6] = 'ISIG_INPUT6',
    [mc.ISIG_INPUT60] = 'ISIG_INPUT60',
    [mc.ISIG_INPUT61] = 'ISIG_INPUT61',
    [mc.ISIG_INPUT62] = 'ISIG_INPUT62',
    [mc.ISIG_INPUT63] = 'ISIG_INPUT63',
    [mc.ISIG_INPUT7] = 'ISIG_INPUT7',
    [mc.ISIG_INPUT8] = 'ISIG_INPUT8',
    [mc.ISIG_INPUT9] = 'ISIG_INPUT9',
    [mc.ISIG_JOGAN] = 'ISIG_JOGAN',
    [mc.ISIG_JOGAP] = 'ISIG_JOGAP',
    [mc.ISIG_JOGBN] = 'ISIG_JOGBN',
    [mc.ISIG_JOGBP] = 'ISIG_JOGBP',
    [mc.ISIG_JOGCN] = 'ISIG_JOGCN',
    [mc.ISIG_JOGCP] = 'ISIG_JOGCP',
    [mc.ISIG_JOGXN] = 'ISIG_JOGXN',
    [mc.ISIG_JOGXP] = 'ISIG_JOGXP',
    [mc.ISIG_JOGYN] = 'ISIG_JOGYN',
    [mc.ISIG_JOGYP] = 'ISIG_JOGYP',
    [mc.ISIG_JOGZN] = 'ISIG_JOGZN',
    [mc.ISIG_JOGZP] = 'ISIG_JOGZP',
    [mc.ISIG_LIMITOVER] = 'ISIG_LIMITOVER',
    [mc.ISIG_MOTOR_HOME_FINISH] = 'ISIG_MOTOR_HOME_FINISH',
    [mc.ISIG_MOTOR_HOME_START] = 'ISIG_MOTOR_HOME_START',
    [mc.ISIG_MOTOR_MINUS_FINISH] = 'ISIG_MOTOR_MINUS_FINISH',
    [mc.ISIG_MOTOR_MINUS_START] = 'ISIG_MOTOR_MINUS_START',
    [mc.ISIG_MOTOR_PLUS_FINISH] = 'ISIG_MOTOR_PLUS_FINISH',
    [mc.ISIG_MOTOR_PLUS_START] = 'ISIG_MOTOR_PLUS_START',
    [mc.ISIG_MOTOR_START] = 'ISIG_MOTOR_START',
    [mc.ISIG_MOTOR0_HOME] = 'ISIG_MOTOR0_HOME',
    [mc.ISIG_MOTOR0_MINUS] = 'ISIG_MOTOR0_MINUS',
    [mc.ISIG_MOTOR0_PLUS] = 'ISIG_MOTOR0_PLUS',
    [mc.ISIG_MOTOR1_HOME] = 'ISIG_MOTOR1_HOME',
    [mc.ISIG_MOTOR1_MINUS] = 'ISIG_MOTOR1_MINUS',
    [mc.ISIG_MOTOR1_PLUS] = 'ISIG_MOTOR1_PLUS',
    [mc.ISIG_MOTOR10_HOME] = 'ISIG_MOTOR10_HOME',
    [mc.ISIG_MOTOR10_MINUS] = 'ISIG_MOTOR10_MINUS',
    [mc.ISIG_MOTOR10_PLUS] = 'ISIG_MOTOR10_PLUS',
    [mc.ISIG_MOTOR11_HOME] = 'ISIG_MOTOR11_HOME',
    [mc.ISIG_MOTOR11_MINUS] = 'ISIG_MOTOR11_MINUS',
    [mc.ISIG_MOTOR11_PLUS] = 'ISIG_MOTOR11_PLUS',
    [mc.ISIG_MOTOR12_HOME] = 'ISIG_MOTOR12_HOME',
    [mc.ISIG_MOTOR12_MINUS] = 'ISIG_MOTOR12_MINUS',
    [mc.ISIG_MOTOR12_PLUS] = 'ISIG_MOTOR12_PLUS',
    [mc.ISIG_MOTOR13_HOME] = 'ISIG_MOTOR13_HOME',
    [mc.ISIG_MOTOR13_MINUS] = 'ISIG_MOTOR13_MINUS',
    [mc.ISIG_MOTOR13_PLUS] = 'ISIG_MOTOR13_PLUS',
    [mc.ISIG_MOTOR14_HOME] = 'ISIG_MOTOR14_HOME',
    [mc.ISIG_MOTOR14_MINUS] = 'ISIG_MOTOR14_MINUS',
    [mc.ISIG_MOTOR14_PLUS] = 'ISIG_MOTOR14_PLUS',
    [mc.ISIG_MOTOR15_HOME] = 'ISIG_MOTOR15_HOME',
    [mc.ISIG_MOTOR15_MINUS] = 'ISIG_MOTOR15_MINUS',
    [mc.ISIG_MOTOR15_PLUS] = 'ISIG_MOTOR15_PLUS',
    [mc.ISIG_MOTOR16_HOME] = 'ISIG_MOTOR16_HOME',
    [mc.ISIG_MOTOR16_MINUS] = 'ISIG_MOTOR16_MINUS',
    [mc.ISIG_MOTOR16_PLUS] = 'ISIG_MOTOR16_PLUS',
    [mc.ISIG_MOTOR17_HOME] = 'ISIG_MOTOR17_HOME',
    [mc.ISIG_MOTOR17_MINUS] = 'ISIG_MOTOR17_MINUS',
    [mc.ISIG_MOTOR17_PLUS] = 'ISIG_MOTOR17_PLUS',
    [mc.ISIG_MOTOR18_HOME] = 'ISIG_MOTOR18_HOME',
    [mc.ISIG_MOTOR18_MINUS] = 'ISIG_MOTOR18_MINUS',
    [mc.ISIG_MOTOR18_PLUS] = 'ISIG_MOTOR18_PLUS',
    [mc.ISIG_MOTOR19_HOME] = 'ISIG_MOTOR19_HOME',
    [mc.ISIG_MOTOR19_MINUS] = 'ISIG_MOTOR19_MINUS',
    [mc.ISIG_MOTOR19_PLUS] = 'ISIG_MOTOR19_PLUS',
    [mc.ISIG_MOTOR2_HOME] = 'ISIG_MOTOR2_HOME',
    [mc.ISIG_MOTOR2_MINUS] = 'ISIG_MOTOR2_MINUS',
    [mc.ISIG_MOTOR2_PLUS] = 'ISIG_MOTOR2_PLUS',
    [mc.ISIG_MOTOR20_HOME] = 'ISIG_MOTOR20_HOME',
    [mc.ISIG_MOTOR20_MINUS] = 'ISIG_MOTOR20_MINUS',
    [mc.ISIG_MOTOR20_PLUS] = 'ISIG_MOTOR20_PLUS',
    [mc.ISIG_MOTOR21_HOME] = 'ISIG_MOTOR21_HOME',
    [mc.ISIG_MOTOR21_MINUS] = 'ISIG_MOTOR21_MINUS',
    [mc.ISIG_MOTOR21_PLUS] = 'ISIG_MOTOR21_PLUS',
    [mc.ISIG_MOTOR22_HOME] = 'ISIG_MOTOR22_HOME',
    [mc.ISIG_MOTOR22_MINUS] = 'ISIG_MOTOR22_MINUS',
    [mc.ISIG_MOTOR22_PLUS] = 'ISIG_MOTOR22_PLUS',
    [mc.ISIG_MOTOR23_HOME] = 'ISIG_MOTOR23_HOME',
    [mc.ISIG_MOTOR23_MINUS] = 'ISIG_MOTOR23_MINUS',
    [mc.ISIG_MOTOR23_PLUS] = 'ISIG_MOTOR23_PLUS',
    [mc.ISIG_MOTOR24_HOME] = 'ISIG_MOTOR24_HOME',
    [mc.ISIG_MOTOR24_MINUS] = 'ISIG_MOTOR24_MINUS',
    [mc.ISIG_MOTOR24_PLUS] = 'ISIG_MOTOR24_PLUS',
    [mc.ISIG_MOTOR25_HOME] = 'ISIG_MOTOR25_HOME',
    [mc.ISIG_MOTOR25_MINUS] = 'ISIG_MOTOR25_MINUS',
    [mc.ISIG_MOTOR25_PLUS] = 'ISIG_MOTOR25_PLUS',
    [mc.ISIG_MOTOR26_HOME] = 'ISIG_MOTOR26_HOME',
    [mc.ISIG_MOTOR26_MINUS] = 'ISIG_MOTOR26_MINUS',
    [mc.ISIG_MOTOR26_PLUS] = 'ISIG_MOTOR26_PLUS',
    [mc.ISIG_MOTOR27_HOME] = 'ISIG_MOTOR27_HOME',
    [mc.ISIG_MOTOR27_MINUS] = 'ISIG_MOTOR27_MINUS',
    [mc.ISIG_MOTOR27_PLUS] = 'ISIG_MOTOR27_PLUS',
    [mc.ISIG_MOTOR28_HOME] = 'ISIG_MOTOR28_HOME',
    [mc.ISIG_MOTOR28_MINUS] = 'ISIG_MOTOR28_MINUS',
    [mc.ISIG_MOTOR28_PLUS] = 'ISIG_MOTOR28_PLUS',
    [mc.ISIG_MOTOR29_HOME] = 'ISIG_MOTOR29_HOME',
    [mc.ISIG_MOTOR29_MINUS] = 'ISIG_MOTOR29_MINUS',
    [mc.ISIG_MOTOR29_PLUS] = 'ISIG_MOTOR29_PLUS',
    [mc.ISIG_MOTOR3_HOME] = 'ISIG_MOTOR3_HOME',
    [mc.ISIG_MOTOR3_MINUS] = 'ISIG_MOTOR3_MINUS',
    [mc.ISIG_MOTOR3_PLUS] = 'ISIG_MOTOR3_PLUS',
    [mc.ISIG_MOTOR30_HOME] = 'ISIG_MOTOR30_HOME',
    [mc.ISIG_MOTOR30_MINUS] = 'ISIG_MOTOR30_MINUS',
    [mc.ISIG_MOTOR30_PLUS] = 'ISIG_MOTOR30_PLUS',
    [mc.ISIG_MOTOR31_HOME] = 'ISIG_MOTOR31_HOME',
    [mc.ISIG_MOTOR31_MINUS] = 'ISIG_MOTOR31_MINUS',
    [mc.ISIG_MOTOR31_PLUS] = 'ISIG_MOTOR31_PLUS',
    [mc.ISIG_MOTOR4_HOME] = 'ISIG_MOTOR4_HOME',
    [mc.ISIG_MOTOR4_MINUS] = 'ISIG_MOTOR4_MINUS',
    [mc.ISIG_MOTOR4_PLUS] = 'ISIG_MOTOR4_PLUS',
    [mc.ISIG_MOTOR5_HOME] = 'ISIG_MOTOR5_HOME',
    [mc.ISIG_MOTOR5_MINUS] = 'ISIG_MOTOR5_MINUS',
    [mc.ISIG_MOTOR5_PLUS] = 'ISIG_MOTOR5_PLUS',
    [mc.ISIG_MOTOR6_HOME] = 'ISIG_MOTOR6_HOME',
    [mc.ISIG_MOTOR6_MINUS] = 'ISIG_MOTOR6_MINUS',
    [mc.ISIG_MOTOR6_PLUS] = 'ISIG_MOTOR6_PLUS',
    [mc.ISIG_MOTOR7_HOME] = 'ISIG_MOTOR7_HOME',
    [mc.ISIG_MOTOR7_MINUS] = 'ISIG_MOTOR7_MINUS',
    [mc.ISIG_MOTOR7_PLUS] = 'ISIG_MOTOR7_PLUS',
    [mc.ISIG_MOTOR8_HOME] = 'ISIG_MOTOR8_HOME',
    [mc.ISIG_MOTOR8_MINUS] = 'ISIG_MOTOR8_MINUS',
    [mc.ISIG_MOTOR8_PLUS] = 'ISIG_MOTOR8_PLUS',
    [mc.ISIG_MOTOR9_HOME] = 'ISIG_MOTOR9_HOME',
    [mc.ISIG_MOTOR9_MINUS] = 'ISIG_MOTOR9_MINUS',
    [mc.ISIG_MOTOR9_PLUS] = 'ISIG_MOTOR9_PLUS',
    [mc.ISIG_SPECIAL_FINISH] = 'ISIG_SPECIAL_FINISH',
    [mc.ISIG_SPECIAL_START] = 'ISIG_SPECIAL_START',
    [mc.ISIG_SPINDLE_AT_SPEED] = 'ISIG_SPINDLE_AT_SPEED',
    [mc.ISIG_SPINDLE_AT_ZERO] = 'ISIG_SPINDLE_AT_ZERO',
    [mc.ISIG_THCDOWN] = 'ISIG_THCDOWN',
    [mc.ISIG_THCON] = 'ISIG_THCON',
    [mc.ISIG_THCUP] = 'ISIG_THCUP',
    [mc.ISIG_TIMING] = 'ISIG_TIMING',
    [mc.MSG_SIG_CHANGED] = 'MSG_SIG_CHANGED',
    [mc.OSIG_AHOME] = 'OSIG_AHOME',
    [mc.OSIG_ALIMITMINUS] = 'OSIG_ALIMITMINUS',
    [mc.OSIG_ALIMITPLUS] = 'OSIG_ALIMITPLUS',
    [mc.OSIG_AXIS_SWITCH_FINISH] = 'OSIG_AXIS_SWITCH_FINISH',
    [mc.OSIG_AXIS_SWITCH_START] = 'OSIG_AXIS_SWITCH_START',
    [mc.OSIG_BHOME] = 'OSIG_BHOME',
    [mc.OSIG_BLIMITMINUS] = 'OSIG_BLIMITMINUS',
    [mc.OSIG_BLIMITPLUS] = 'OSIG_BLIMITPLUS',
    [mc.OSIG_BLOCK_DELETE] = 'OSIG_BLOCK_DELETE',
    [mc.OSIG_CHARGE] = 'OSIG_CHARGE',
    [mc.OSIG_CHARGE2] = 'OSIG_CHARGE2',
    [mc.OSIG_CHOME] = 'OSIG_CHOME',
    [mc.OSIG_CLIMITMINUS] = 'OSIG_CLIMITMINUS',
    [mc.OSIG_CLIMITPLUS] = 'OSIG_CLIMITPLUS',
    [mc.OSIG_COOLANTON] = 'OSIG_COOLANTON',
    [mc.OSIG_CURRENTHILOW] = 'OSIG_CURRENTHILOW',
    [mc.OSIG_DIGTRIGGER] = 'OSIG_DIGTRIGGER',
    [mc.OSIG_DIST_TOGO] = 'OSIG_DIST_TOGO',
    [mc.OSIG_DWELL] = 'OSIG_DWELL',
    [mc.OSIG_ENABLE_FINISH] = 'OSIG_ENABLE_FINISH',
    [mc.OSIG_ENABLE_START] = 'OSIG_ENABLE_START',
    [mc.OSIG_ENABLE0] = 'OSIG_ENABLE0',
    [mc.OSIG_ENABLE1] = 'OSIG_ENABLE1',
    [mc.OSIG_ENABLE10] = 'OSIG_ENABLE10',
    [mc.OSIG_ENABLE11] = 'OSIG_ENABLE11',
    [mc.OSIG_ENABLE12] = 'OSIG_ENABLE12',
    [mc.OSIG_ENABLE13] = 'OSIG_ENABLE13',
    [mc.OSIG_ENABLE14] = 'OSIG_ENABLE14',
    [mc.OSIG_ENABLE15] = 'OSIG_ENABLE15',
    [mc.OSIG_ENABLE16] = 'OSIG_ENABLE16',
    [mc.OSIG_ENABLE17] = 'OSIG_ENABLE17',
    [mc.OSIG_ENABLE18] = 'OSIG_ENABLE18',
    [mc.OSIG_ENABLE19] = 'OSIG_ENABLE19',
    [mc.OSIG_ENABLE2] = 'OSIG_ENABLE2',
    [mc.OSIG_ENABLE20] = 'OSIG_ENABLE20',
    [mc.OSIG_ENABLE21] = 'OSIG_ENABLE21',
    [mc.OSIG_ENABLE22] = 'OSIG_ENABLE22',
    [mc.OSIG_ENABLE23] = 'OSIG_ENABLE23',
    [mc.OSIG_ENABLE24] = 'OSIG_ENABLE24',
    [mc.OSIG_ENABLE25] = 'OSIG_ENABLE25',
    [mc.OSIG_ENABLE26] = 'OSIG_ENABLE26',
    [mc.OSIG_ENABLE27] = 'OSIG_ENABLE27',
    [mc.OSIG_ENABLE28] = 'OSIG_ENABLE28',
    [mc.OSIG_ENABLE29] = 'OSIG_ENABLE29',
    [mc.OSIG_ENABLE3] = 'OSIG_ENABLE3',
    [mc.OSIG_ENABLE30] = 'OSIG_ENABLE30',
    [mc.OSIG_ENABLE31] = 'OSIG_ENABLE31',
    [mc.OSIG_ENABLE4] = 'OSIG_ENABLE4',
    [mc.OSIG_ENABLE5] = 'OSIG_ENABLE5',
    [mc.OSIG_ENABLE6] = 'OSIG_ENABLE6',
    [mc.OSIG_ENABLE7] = 'OSIG_ENABLE7',
    [mc.OSIG_ENABLE8] = 'OSIG_ENABLE8',
    [mc.OSIG_ENABLE9] = 'OSIG_ENABLE9',
    [mc.OSIG_FEEDHOLD] = 'OSIG_FEEDHOLD',
    [mc.OSIG_HOMED_A] = 'OSIG_HOMED_A',
    [mc.OSIG_HOMED_B] = 'OSIG_HOMED_B',
    [mc.OSIG_HOMED_C] = 'OSIG_HOMED_C',
    [mc.OSIG_HOMED_X] = 'OSIG_HOMED_X',
    [mc.OSIG_HOMED_Y] = 'OSIG_HOMED_Y',
    [mc.OSIG_HOMED_Z] = 'OSIG_HOMED_Z',
    [mc.OSIG_JOG_CONT] = 'OSIG_JOG_CONT',
    [mc.OSIG_JOG_ENABLED] = 'OSIG_JOG_ENABLED',
    [mc.OSIG_JOG_INC] = 'OSIG_JOG_INC',
    [mc.OSIG_JOG_MPG] = 'OSIG_JOG_MPG',
    [mc.OSIG_LIMITOVER] = 'OSIG_LIMITOVER',
    [mc.OSIG_MACHINE_CORD] = 'OSIG_MACHINE_CORD',
    [mc.OSIG_MACHINE_ENABLED] = 'OSIG_MACHINE_ENABLED',
    [mc.OSIG_MISC_FINISH] = 'OSIG_MISC_FINISH',
    [mc.OSIG_MISC_START] = 'OSIG_MISC_START',
    [mc.OSIG_MISTON] = 'OSIG_MISTON',
    [mc.OSIG_OPT_STOP] = 'OSIG_OPT_STOP',
    [mc.OSIG_OUTPUT_FINISH] = 'OSIG_OUTPUT_FINISH',
    [mc.OSIG_OUTPUT_START] = 'OSIG_OUTPUT_START',
    [mc.OSIG_OUTPUT0] = 'OSIG_OUTPUT0',
    [mc.OSIG_OUTPUT1] = 'OSIG_OUTPUT1',
    [mc.OSIG_OUTPUT10] = 'OSIG_OUTPUT10',
    [mc.OSIG_OUTPUT11] = 'OSIG_OUTPUT11',
    [mc.OSIG_OUTPUT12] = 'OSIG_OUTPUT12',
    [mc.OSIG_OUTPUT13] = 'OSIG_OUTPUT13',
    [mc.OSIG_OUTPUT14] = 'OSIG_OUTPUT14',
    [mc.OSIG_OUTPUT15] = 'OSIG_OUTPUT15',
    [mc.OSIG_OUTPUT16] = 'OSIG_OUTPUT16',
    [mc.OSIG_OUTPUT17] = 'OSIG_OUTPUT17',
    [mc.OSIG_OUTPUT18] = 'OSIG_OUTPUT18',
    [mc.OSIG_OUTPUT19] = 'OSIG_OUTPUT19',
    [mc.OSIG_OUTPUT2] = 'OSIG_OUTPUT2',
    [mc.OSIG_OUTPUT20] = 'OSIG_OUTPUT20',
    [mc.OSIG_OUTPUT21] = 'OSIG_OUTPUT21',
    [mc.OSIG_OUTPUT22] = 'OSIG_OUTPUT22',
    [mc.OSIG_OUTPUT23] = 'OSIG_OUTPUT23',
    [mc.OSIG_OUTPUT24] = 'OSIG_OUTPUT24',
    [mc.OSIG_OUTPUT25] = 'OSIG_OUTPUT25',
    [mc.OSIG_OUTPUT26] = 'OSIG_OUTPUT26',
    [mc.OSIG_OUTPUT27] = 'OSIG_OUTPUT27',
    [mc.OSIG_OUTPUT28] = 'OSIG_OUTPUT28',
    [mc.OSIG_OUTPUT29] = 'OSIG_OUTPUT29',
    [mc.OSIG_OUTPUT3] = 'OSIG_OUTPUT3',
    [mc.OSIG_OUTPUT30] = 'OSIG_OUTPUT30',
    [mc.OSIG_OUTPUT31] = 'OSIG_OUTPUT31',
    [mc.OSIG_OUTPUT32] = 'OSIG_OUTPUT32',
    [mc.OSIG_OUTPUT33] = 'OSIG_OUTPUT33',
    [mc.OSIG_OUTPUT34] = 'OSIG_OUTPUT34',
    [mc.OSIG_OUTPUT35] = 'OSIG_OUTPUT35',
    [mc.OSIG_OUTPUT36] = 'OSIG_OUTPUT36',
    [mc.OSIG_OUTPUT37] = 'OSIG_OUTPUT37',
    [mc.OSIG_OUTPUT38] = 'OSIG_OUTPUT38',
    [mc.OSIG_OUTPUT39] = 'OSIG_OUTPUT39',
    [mc.OSIG_OUTPUT4] = 'OSIG_OUTPUT4',
    [mc.OSIG_OUTPUT40] = 'OSIG_OUTPUT40',
    [mc.OSIG_OUTPUT41] = 'OSIG_OUTPUT41',
    [mc.OSIG_OUTPUT42] = 'OSIG_OUTPUT42',
    [mc.OSIG_OUTPUT43] = 'OSIG_OUTPUT43',
    [mc.OSIG_OUTPUT44] = 'OSIG_OUTPUT44',
    [mc.OSIG_OUTPUT45] = 'OSIG_OUTPUT45',
    [mc.OSIG_OUTPUT46] = 'OSIG_OUTPUT46',
    [mc.OSIG_OUTPUT47] = 'OSIG_OUTPUT47',
    [mc.OSIG_OUTPUT48] = 'OSIG_OUTPUT48',
    [mc.OSIG_OUTPUT49] = 'OSIG_OUTPUT49',
    [mc.OSIG_OUTPUT5] = 'OSIG_OUTPUT5',
    [mc.OSIG_OUTPUT50] = 'OSIG_OUTPUT50',
    [mc.OSIG_OUTPUT51] = 'OSIG_OUTPUT51',
    [mc.OSIG_OUTPUT52] = 'OSIG_OUTPUT52',
    [mc.OSIG_OUTPUT53] = 'OSIG_OUTPUT53',
    [mc.OSIG_OUTPUT54] = 'OSIG_OUTPUT54',
    [mc.OSIG_OUTPUT55] = 'OSIG_OUTPUT55',
    [mc.OSIG_OUTPUT56] = 'OSIG_OUTPUT56',
    [mc.OSIG_OUTPUT57] = 'OSIG_OUTPUT57',
    [mc.OSIG_OUTPUT58] = 'OSIG_OUTPUT58',
    [mc.OSIG_OUTPUT59] = 'OSIG_OUTPUT59',
    [mc.OSIG_OUTPUT6] = 'OSIG_OUTPUT6',
    [mc.OSIG_OUTPUT60] = 'OSIG_OUTPUT60',
    [mc.OSIG_OUTPUT61] = 'OSIG_OUTPUT61',
    [mc.OSIG_OUTPUT62] = 'OSIG_OUTPUT62',
    [mc.OSIG_OUTPUT63] = 'OSIG_OUTPUT63',
    [mc.OSIG_OUTPUT7] = 'OSIG_OUTPUT7',
    [mc.OSIG_OUTPUT8] = 'OSIG_OUTPUT8',
    [mc.OSIG_OUTPUT9] = 'OSIG_OUTPUT9',
    [mc.OSIG_REVERSE_RUN] = 'OSIG_REVERSE_RUN',
    [mc.OSIG_RUNNING_GCODE] = 'OSIG_RUNNING_GCODE',
    [mc.OSIG_SINGLE_BLOCK] = 'OSIG_SINGLE_BLOCK',
    [mc.OSIG_SOFTLIMITS_ON] = 'OSIG_SOFTLIMITS_ON',
    [mc.OSIG_SPINDLEFWD] = 'OSIG_SPINDLEFWD',
    [mc.OSIG_SPINDLEON] = 'OSIG_SPINDLEON',
    [mc.OSIG_SPINDLEREV] = 'OSIG_SPINDLEREV',
    [mc.OSIG_TOOL_CHANGE] = 'OSIG_TOOL_CHANGE',
    [mc.OSIG_TP_MOUSE_DN] = 'OSIG_TP_MOUSE_DN',
    [mc.OSIG_XHOME] = 'OSIG_XHOME',
    [mc.OSIG_XLIMITMINUS] = 'OSIG_XLIMITMINUS',
    [mc.OSIG_XLIMITPLUS] = 'OSIG_XLIMITPLUS',
    [mc.OSIG_YHOME] = 'OSIG_YHOME',
    [mc.OSIG_YLIMITMINUS] = 'OSIG_YLIMITMINUS',
    [mc.OSIG_YLIMITPLUS] = 'OSIG_YLIMITPLUS',
    [mc.OSIG_ZHOME] = 'OSIG_ZHOME',
    [mc.OSIG_ZLIMITMINUS] = 'OSIG_ZLIMITMINUS',
    [mc.OSIG_ZLIMITPLUS] = 'OSIG_ZLIMITPLUS',
    [mc.SIG_TYPE_INPUT] = 'SIG_TYPE_INPUT',
    [mc.SIG_TYPE_NONE] = 'SIG_TYPE_NONE',
    [mc.SIG_TYPE_OUTPUT] = 'SIG_TYPE_OUTPUT',
}

if(SigLib[sig] ~= nil)then
    local sigName = sigNames[sig] or sig;
    mc.mcCntlSetLastError(inst,'State - '..sigName..' = '..tostring(state));
    SigLib[sig](state);  -- comment out if you don't have any SigLib definitions in your screen startup script.
end

A sample history log from my X3 looks like:

Code: [Select]
State - ISIG_MOTOR0_HOME = 1
State - OSIG_HOME_START: 1
State - OSIG_HOMED_X = 1


-Freeman

Title: Re: Signal Scripts
Post by: Ya-Nvr-No on July 23, 2014, 09:44:59 AM
thats pretty cool, but it does not display the spindle or coolant on and off, wonder why?
probably a few more, but just starting to play

did reformat it a little cause i'm a little  >:D

Code: [Select]
local sigNames = {
[mc.ISIG_INPUT0]  = 'ISIG_INPUT0',
[mc.ISIG_INPUT1]  = 'ISIG_INPUT1',
[mc.ISIG_INPUT2]  = 'ISIG_INPUT2',
[mc.ISIG_INPUT3]  = 'ISIG_INPUT3',
[mc.ISIG_INPUT4]  = 'ISIG_INPUT4',
[mc.ISIG_INPUT5]  = 'ISIG_INPUT5',
[mc.ISIG_INPUT6]  = 'ISIG_INPUT6',
[mc.ISIG_INPUT7]  = 'ISIG_INPUT7',
[mc.ISIG_INPUT8]  = 'ISIG_INPUT8',
[mc.ISIG_INPUT9]  = 'ISIG_INPUT9',
[mc.ISIG_INPUT10] = 'ISIG_INPUT10',
[mc.ISIG_INPUT11] = 'ISIG_INPUT11',
[mc.ISIG_INPUT12] = 'ISIG_INPUT12',
[mc.ISIG_INPUT13] = 'ISIG_INPUT13',
[mc.ISIG_INPUT14] = 'ISIG_INPUT14',
[mc.ISIG_INPUT15] = 'ISIG_INPUT15',
[mc.ISIG_INPUT16] = 'ISIG_INPUT16',
[mc.ISIG_INPUT17] = 'ISIG_INPUT17',
[mc.ISIG_INPUT18] = 'ISIG_INPUT18',
[mc.ISIG_INPUT19] = 'ISIG_INPUT19',
[mc.ISIG_INPUT20] = 'ISIG_INPUT20',
[mc.ISIG_INPUT21] = 'ISIG_INPUT21',
[mc.ISIG_INPUT22] = 'ISIG_INPUT22',
[mc.ISIG_INPUT23] = 'ISIG_INPUT23',
[mc.ISIG_INPUT24] = 'ISIG_INPUT24',
[mc.ISIG_INPUT25] = 'ISIG_INPUT25',
[mc.ISIG_INPUT26] = 'ISIG_INPUT26',
[mc.ISIG_INPUT27] = 'ISIG_INPUT27',
[mc.ISIG_INPUT28] = 'ISIG_INPUT28',
[mc.ISIG_INPUT29] = 'ISIG_INPUT29',
[mc.ISIG_INPUT30] = 'ISIG_INPUT30',
[mc.ISIG_INPUT31] = 'ISIG_INPUT31',
[mc.ISIG_INPUT32] = 'ISIG_INPUT32',
[mc.ISIG_INPUT33] = 'ISIG_INPUT33',
[mc.ISIG_INPUT34] = 'ISIG_INPUT34',
[mc.ISIG_INPUT35] = 'ISIG_INPUT35',
[mc.ISIG_INPUT36] = 'ISIG_INPUT36',
[mc.ISIG_INPUT37] = 'ISIG_INPUT37',
[mc.ISIG_INPUT38] = 'ISIG_INPUT38',
[mc.ISIG_INPUT39] = 'ISIG_INPUT39',
[mc.ISIG_INPUT40] = 'ISIG_INPUT40',
[mc.ISIG_INPUT41] = 'ISIG_INPUT41',
[mc.ISIG_INPUT42] = 'ISIG_INPUT42',
[mc.ISIG_INPUT43] = 'ISIG_INPUT43',
[mc.ISIG_INPUT44] = 'ISIG_INPUT44',
[mc.ISIG_INPUT45] = 'ISIG_INPUT45',
[mc.ISIG_INPUT46] = 'ISIG_INPUT46',
[mc.ISIG_INPUT47] = 'ISIG_INPUT47',
[mc.ISIG_INPUT48] = 'ISIG_INPUT48',
[mc.ISIG_INPUT49] = 'ISIG_INPUT49',
[mc.ISIG_INPUT50] = 'ISIG_INPUT50',
[mc.ISIG_INPUT51] = 'ISIG_INPUT51',
[mc.ISIG_INPUT52] = 'ISIG_INPUT52',
[mc.ISIG_INPUT53] = 'ISIG_INPUT53',
[mc.ISIG_INPUT54] = 'ISIG_INPUT54',
[mc.ISIG_INPUT55] = 'ISIG_INPUT55',
[mc.ISIG_INPUT56] = 'ISIG_INPUT56',
[mc.ISIG_INPUT57] = 'ISIG_INPUT57',
[mc.ISIG_INPUT58] = 'ISIG_INPUT58',
[mc.ISIG_INPUT59] = 'ISIG_INPUT59',
[mc.ISIG_INPUT60] = 'ISIG_INPUT60',
[mc.ISIG_INPUT61] = 'ISIG_INPUT61',
[mc.ISIG_INPUT62] = 'ISIG_INPUT62',
[mc.ISIG_INPUT63] = 'ISIG_INPUT63',

[mc.ISIG_MOTOR0_HOME] = 'ISIG_MOTOR0_HOME',
[mc.ISIG_MOTOR1_HOME] = 'ISIG_MOTOR1_HOME',
[mc.ISIG_MOTOR2_HOME] = 'ISIG_MOTOR2_HOME',
[mc.ISIG_MOTOR3_HOME] = 'ISIG_MOTOR3_HOME',
[mc.ISIG_MOTOR4_HOME] = 'ISIG_MOTOR4_HOME',
[mc.ISIG_MOTOR5_HOME] = 'ISIG_MOTOR5_HOME',
[mc.ISIG_MOTOR6_HOME] = 'ISIG_MOTOR6_HOME',
[mc.ISIG_MOTOR7_HOME] = 'ISIG_MOTOR7_HOME',
[mc.ISIG_MOTOR8_HOME] = 'ISIG_MOTOR8_HOME',
[mc.ISIG_MOTOR9_HOME] = 'ISIG_MOTOR9_HOME',
[mc.ISIG_MOTOR10_HOME] = 'ISIG_MOTOR10_HOME',
[mc.ISIG_MOTOR11_HOME] = 'ISIG_MOTOR11_HOME',
[mc.ISIG_MOTOR12_HOME] = 'ISIG_MOTOR12_HOME',
[mc.ISIG_MOTOR13_HOME] = 'ISIG_MOTOR13_HOME',
[mc.ISIG_MOTOR14_HOME] = 'ISIG_MOTOR14_HOME',
[mc.ISIG_MOTOR15_HOME] = 'ISIG_MOTOR15_HOME',
[mc.ISIG_MOTOR16_HOME] = 'ISIG_MOTOR16_HOME',
[mc.ISIG_MOTOR17_HOME] = 'ISIG_MOTOR17_HOME',
[mc.ISIG_MOTOR18_HOME] = 'ISIG_MOTOR18_HOME',
[mc.ISIG_MOTOR19_HOME] = 'ISIG_MOTOR19_HOME',
[mc.ISIG_MOTOR20_HOME] = 'ISIG_MOTOR20_HOME',
[mc.ISIG_MOTOR21_HOME] = 'ISIG_MOTOR21_HOME',
[mc.ISIG_MOTOR22_HOME] = 'ISIG_MOTOR22_HOME',
[mc.ISIG_MOTOR23_HOME] = 'ISIG_MOTOR23_HOME',
[mc.ISIG_MOTOR24_HOME] = 'ISIG_MOTOR24_HOME',
[mc.ISIG_MOTOR25_HOME] = 'ISIG_MOTOR25_HOME',
[mc.ISIG_MOTOR26_HOME] = 'ISIG_MOTOR26_HOME',
[mc.ISIG_MOTOR27_HOME] = 'ISIG_MOTOR27_HOME',
[mc.ISIG_MOTOR28_HOME] = 'ISIG_MOTOR28_HOME',
[mc.ISIG_MOTOR29_HOME] = 'ISIG_MOTOR29_HOME',
[mc.ISIG_MOTOR30_HOME] = 'ISIG_MOTOR30_HOME',
[mc.ISIG_MOTOR31_HOME] = 'ISIG_MOTOR31_HOME',

[mc.ISIG_MOTOR0_MINUS] = 'ISIG_MOTOR0_MINUS',
[mc.ISIG_MOTOR1_MINUS] = 'ISIG_MOTOR1_MINUS',
[mc.ISIG_MOTOR2_MINUS] = 'ISIG_MOTOR2_MINUS',
[mc.ISIG_MOTOR3_MINUS] = 'ISIG_MOTOR3_MINUS',
[mc.ISIG_MOTOR4_MINUS] = 'ISIG_MOTOR4_MINUS',
[mc.ISIG_MOTOR5_MINUS] = 'ISIG_MOTOR5_MINUS',
[mc.ISIG_MOTOR6_MINUS] = 'ISIG_MOTOR6_MINUS',
[mc.ISIG_MOTOR7_MINUS] = 'ISIG_MOTOR7_MINUS',
[mc.ISIG_MOTOR8_MINUS] = 'ISIG_MOTOR8_MINUS',
[mc.ISIG_MOTOR9_MINUS] = 'ISIG_MOTOR9_MINUS',
[mc.ISIG_MOTOR10_MINUS] = 'ISIG_MOTOR10_MINUS',
[mc.ISIG_MOTOR11_MINUS] = 'ISIG_MOTOR11_MINUS',
[mc.ISIG_MOTOR12_MINUS] = 'ISIG_MOTOR12_MINUS',
[mc.ISIG_MOTOR13_MINUS] = 'ISIG_MOTOR13_MINUS',
[mc.ISIG_MOTOR14_MINUS] = 'ISIG_MOTOR14_MINUS',
[mc.ISIG_MOTOR15_MINUS] = 'ISIG_MOTOR15_MINUS',
[mc.ISIG_MOTOR16_MINUS] = 'ISIG_MOTOR16_MINUS',
[mc.ISIG_MOTOR17_MINUS] = 'ISIG_MOTOR17_MINUS',
[mc.ISIG_MOTOR18_MINUS] = 'ISIG_MOTOR18_MINUS',
[mc.ISIG_MOTOR19_MINUS] = 'ISIG_MOTOR19_MINUS',
[mc.ISIG_MOTOR20_MINUS] = 'ISIG_MOTOR20_MINUS',
[mc.ISIG_MOTOR21_MINUS] = 'ISIG_MOTOR21_MINUS',
[mc.ISIG_MOTOR22_MINUS] = 'ISIG_MOTOR22_MINUS',
[mc.ISIG_MOTOR23_MINUS] = 'ISIG_MOTOR23_MINUS',
[mc.ISIG_MOTOR24_MINUS] = 'ISIG_MOTOR24_MINUS',
[mc.ISIG_MOTOR25_MINUS] = 'ISIG_MOTOR25_MINUS',
[mc.ISIG_MOTOR26_MINUS] = 'ISIG_MOTOR26_MINUS',
[mc.ISIG_MOTOR27_MINUS] = 'ISIG_MOTOR27_MINUS',
[mc.ISIG_MOTOR28_MINUS] = 'ISIG_MOTOR28_MINUS',
[mc.ISIG_MOTOR29_MINUS] = 'ISIG_MOTOR29_MINUS',
[mc.ISIG_MOTOR30_MINUS] = 'ISIG_MOTOR30_MINUS',
[mc.ISIG_MOTOR31_MINUS] = 'ISIG_MOTOR31_MINUS',

[mc.ISIG_MOTOR0_PLUS] = 'ISIG_MOTOR0_PLUS',
[mc.ISIG_MOTOR1_PLUS] = 'ISIG_MOTOR1_PLUS',
[mc.ISIG_MOTOR2_PLUS] = 'ISIG_MOTOR2_PLUS',
[mc.ISIG_MOTOR3_PLUS] = 'ISIG_MOTOR3_PLUS',
[mc.ISIG_MOTOR4_PLUS] = 'ISIG_MOTOR4_PLUS',
[mc.ISIG_MOTOR5_PLUS] = 'ISIG_MOTOR5_PLUS',
[mc.ISIG_MOTOR6_PLUS] = 'ISIG_MOTOR6_PLUS',
[mc.ISIG_MOTOR7_PLUS] = 'ISIG_MOTOR7_PLUS',
[mc.ISIG_MOTOR8_PLUS] = 'ISIG_MOTOR8_PLUS',
[mc.ISIG_MOTOR9_PLUS] = 'ISIG_MOTOR9_PLUS',
[mc.ISIG_MOTOR10_PLUS] = 'ISIG_MOTOR10_PLUS',
[mc.ISIG_MOTOR11_PLUS] = 'ISIG_MOTOR11_PLUS',
[mc.ISIG_MOTOR12_PLUS] = 'ISIG_MOTOR12_PLUS',
[mc.ISIG_MOTOR13_PLUS] = 'ISIG_MOTOR13_PLUS',
[mc.ISIG_MOTOR14_PLUS] = 'ISIG_MOTOR14_PLUS',
[mc.ISIG_MOTOR15_PLUS] = 'ISIG_MOTOR15_PLUS',
[mc.ISIG_MOTOR16_PLUS] = 'ISIG_MOTOR16_PLUS',
[mc.ISIG_MOTOR17_PLUS] = 'ISIG_MOTOR17_PLUS',
[mc.ISIG_MOTOR18_PLUS] = 'ISIG_MOTOR18_PLUS',
[mc.ISIG_MOTOR19_PLUS] = 'ISIG_MOTOR19_PLUS',
[mc.ISIG_MOTOR20_PLUS] = 'ISIG_MOTOR20_PLUS',
[mc.ISIG_MOTOR21_PLUS] = 'ISIG_MOTOR21_PLUS',
[mc.ISIG_MOTOR22_PLUS] = 'ISIG_MOTOR22_PLUS',
[mc.ISIG_MOTOR23_PLUS] = 'ISIG_MOTOR23_PLUS',
[mc.ISIG_MOTOR24_PLUS] = 'ISIG_MOTOR24_PLUS',
[mc.ISIG_MOTOR25_PLUS] = 'ISIG_MOTOR25_PLUS',
[mc.ISIG_MOTOR26_PLUS] = 'ISIG_MOTOR26_PLUS',
[mc.ISIG_MOTOR27_PLUS] = 'ISIG_MOTOR27_PLUS',
[mc.ISIG_MOTOR28_PLUS] = 'ISIG_MOTOR28_PLUS',
[mc.ISIG_MOTOR29_PLUS] = 'ISIG_MOTOR29_PLUS',
[mc.ISIG_MOTOR30_PLUS] = 'ISIG_MOTOR30_PLUS',
[mc.ISIG_MOTOR31_PLUS] = 'ISIG_MOTOR31_PLUS',

[mc.ISIG_JOGXN] = 'ISIG_JOGXN',
[mc.ISIG_JOGYN] = 'ISIG_JOGYN',
[mc.ISIG_JOGZN] = 'ISIG_JOGZN',
[mc.ISIG_JOGAN] = 'ISIG_JOGAN',
[mc.ISIG_JOGBN] = 'ISIG_JOGBN',
[mc.ISIG_JOGCN] = 'ISIG_JOGCN',

[mc.ISIG_JOGXP] = 'ISIG_JOGXP',
[mc.ISIG_JOGYP] = 'ISIG_JOGYP',
[mc.ISIG_JOGZP] = 'ISIG_JOGZP',
[mc.ISIG_JOGAP] = 'ISIG_JOGAP',
[mc.ISIG_JOGBP] = 'ISIG_JOGBP',
[mc.ISIG_JOGCP] = 'ISIG_JOGCP',

[mc.ISIG_INDEX] = 'ISIG_INDEX',
[mc.ISIG_TIMING] = 'ISIG_TIMING',
[mc.ISIG_LIMITOVER] = 'ISIG_LIMITOVER',
[mc.ISIG_DIGITIZE] = 'ISIG_DIGITIZE',
[mc.ISIG_EMERGENCY] = 'ISIG_EMERGENCY',

[mc.ISIG_MOTOR_START] = 'ISIG_MOTOR_START',

[mc.ISIG_MOTOR_HOME_START] = 'ISIG_MOTOR_HOME_START',
[mc.ISIG_MOTOR_PLUS_START] = 'ISIG_MOTOR_PLUS_START',
[mc.ISIG_MOTOR_MINUS_START] = 'ISIG_MOTOR_MINUS_START',

[mc.ISIG_MOTOR_HOME_FINISH] = 'ISIG_MOTOR_HOME_FINISH',
[mc.ISIG_MOTOR_PLUS_FINISH] = 'ISIG_MOTOR_PLUS_FINISH',
[mc.ISIG_MOTOR_MINUS_FINISH] = 'ISIG_MOTOR_MINUS_FINISH',

[mc.ISIG_INPUT_START] = 'ISIG_INPUT_START',
[mc.ISIG_INPUT_FINISH] = 'ISIG_INPUT_FINISH',

[mc.ISIG_SPECIAL_START] = 'ISIG_SPECIAL_START',
[mc.ISIG_SPECIAL_FINISH] = 'ISIG_SPECIAL_FINISH',

[mc.ISIG_SPINDLE_AT_ZERO] = 'ISIG_SPINDLE_AT_ZERO',
[mc.ISIG_SPINDLE_AT_SPEED] = 'ISIG_SPINDLE_AT_SPEED',

[mc.ISIG_THCON] = 'ISIG_THCON',
[mc.ISIG_THCUP] = 'ISIG_THCUP',
[mc.ISIG_THCDOWN] = 'ISIG_THCDOWN',

[mc.OSIG_ENABLE0] = 'OSIG_ENABLE0',
[mc.OSIG_ENABLE1] = 'OSIG_ENABLE1',
[mc.OSIG_ENABLE2] = 'OSIG_ENABLE2',
[mc.OSIG_ENABLE3] = 'OSIG_ENABLE3',
[mc.OSIG_ENABLE4] = 'OSIG_ENABLE4',
[mc.OSIG_ENABLE5] = 'OSIG_ENABLE5',
[mc.OSIG_ENABLE6] = 'OSIG_ENABLE6',
[mc.OSIG_ENABLE7] = 'OSIG_ENABLE7',
[mc.OSIG_ENABLE8] = 'OSIG_ENABLE8',
[mc.OSIG_ENABLE9] = 'OSIG_ENABLE9',
[mc.OSIG_ENABLE10] = 'OSIG_ENABLE10',
[mc.OSIG_ENABLE11] = 'OSIG_ENABLE11',
[mc.OSIG_ENABLE12] = 'OSIG_ENABLE12',
[mc.OSIG_ENABLE13] = 'OSIG_ENABLE13',
[mc.OSIG_ENABLE14] = 'OSIG_ENABLE14',
[mc.OSIG_ENABLE15] = 'OSIG_ENABLE15',
[mc.OSIG_ENABLE16] = 'OSIG_ENABLE16',
[mc.OSIG_ENABLE17] = 'OSIG_ENABLE17',
[mc.OSIG_ENABLE18] = 'OSIG_ENABLE18',
[mc.OSIG_ENABLE19] = 'OSIG_ENABLE19',
[mc.OSIG_ENABLE20] = 'OSIG_ENABLE20',
[mc.OSIG_ENABLE21] = 'OSIG_ENABLE21',
[mc.OSIG_ENABLE22] = 'OSIG_ENABLE22',
[mc.OSIG_ENABLE23] = 'OSIG_ENABLE23',
[mc.OSIG_ENABLE24] = 'OSIG_ENABLE24',
[mc.OSIG_ENABLE25] = 'OSIG_ENABLE25',
[mc.OSIG_ENABLE26] = 'OSIG_ENABLE26',
[mc.OSIG_ENABLE27] = 'OSIG_ENABLE27',
[mc.OSIG_ENABLE28] = 'OSIG_ENABLE28',
[mc.OSIG_ENABLE29] = 'OSIG_ENABLE29',
[mc.OSIG_ENABLE30] = 'OSIG_ENABLE30',
[mc.OSIG_ENABLE31] = 'OSIG_ENABLE31',

[mc.OSIG_OUTPUT0] = 'OSIG_OUTPUT0',
[mc.OSIG_OUTPUT1] = 'OSIG_OUTPUT1',
[mc.OSIG_OUTPUT2] = 'OSIG_OUTPUT2',
[mc.OSIG_OUTPUT3] = 'OSIG_OUTPUT3',
[mc.OSIG_OUTPUT4] = 'OSIG_OUTPUT4',
[mc.OSIG_OUTPUT5] = 'OSIG_OUTPUT5',
[mc.OSIG_OUTPUT6] = 'OSIG_OUTPUT6',
[mc.OSIG_OUTPUT7] = 'OSIG_OUTPUT7',
[mc.OSIG_OUTPUT8] = 'OSIG_OUTPUT8',
[mc.OSIG_OUTPUT9] = 'OSIG_OUTPUT9',
[mc.OSIG_OUTPUT10] = 'OSIG_OUTPUT10',
[mc.OSIG_OUTPUT11] = 'OSIG_OUTPUT11',
[mc.OSIG_OUTPUT12] = 'OSIG_OUTPUT12',
[mc.OSIG_OUTPUT13] = 'OSIG_OUTPUT13',
[mc.OSIG_OUTPUT14] = 'OSIG_OUTPUT14',
[mc.OSIG_OUTPUT15] = 'OSIG_OUTPUT15',
[mc.OSIG_OUTPUT16] = 'OSIG_OUTPUT16',
[mc.OSIG_OUTPUT17] = 'OSIG_OUTPUT17',
[mc.OSIG_OUTPUT18] = 'OSIG_OUTPUT18',
[mc.OSIG_OUTPUT19] = 'OSIG_OUTPUT19',
[mc.OSIG_OUTPUT20] = 'OSIG_OUTPUT20',
[mc.OSIG_OUTPUT21] = 'OSIG_OUTPUT21',
[mc.OSIG_OUTPUT22] = 'OSIG_OUTPUT22',
[mc.OSIG_OUTPUT23] = 'OSIG_OUTPUT23',
[mc.OSIG_OUTPUT24] = 'OSIG_OUTPUT24',
[mc.OSIG_OUTPUT25] = 'OSIG_OUTPUT25',
[mc.OSIG_OUTPUT26] = 'OSIG_OUTPUT26',
[mc.OSIG_OUTPUT27] = 'OSIG_OUTPUT27',
[mc.OSIG_OUTPUT28] = 'OSIG_OUTPUT28',
[mc.OSIG_OUTPUT29] = 'OSIG_OUTPUT29',
[mc.OSIG_OUTPUT30] = 'OSIG_OUTPUT30',
[mc.OSIG_OUTPUT31] = 'OSIG_OUTPUT31',
[mc.OSIG_OUTPUT32] = 'OSIG_OUTPUT32',
[mc.OSIG_OUTPUT33] = 'OSIG_OUTPUT33',
[mc.OSIG_OUTPUT34] = 'OSIG_OUTPUT34',
[mc.OSIG_OUTPUT35] = 'OSIG_OUTPUT35',
[mc.OSIG_OUTPUT36] = 'OSIG_OUTPUT36',
[mc.OSIG_OUTPUT37] = 'OSIG_OUTPUT37',
[mc.OSIG_OUTPUT38] = 'OSIG_OUTPUT38',
[mc.OSIG_OUTPUT39] = 'OSIG_OUTPUT39',
[mc.OSIG_OUTPUT40] = 'OSIG_OUTPUT40',
[mc.OSIG_OUTPUT41] = 'OSIG_OUTPUT41',
[mc.OSIG_OUTPUT42] = 'OSIG_OUTPUT42',
[mc.OSIG_OUTPUT43] = 'OSIG_OUTPUT43',
[mc.OSIG_OUTPUT44] = 'OSIG_OUTPUT44',
[mc.OSIG_OUTPUT45] = 'OSIG_OUTPUT45',
[mc.OSIG_OUTPUT46] = 'OSIG_OUTPUT46',
[mc.OSIG_OUTPUT47] = 'OSIG_OUTPUT47',
[mc.OSIG_OUTPUT48] = 'OSIG_OUTPUT48',
[mc.OSIG_OUTPUT49] = 'OSIG_OUTPUT49',
[mc.OSIG_OUTPUT50] = 'OSIG_OUTPUT50',
[mc.OSIG_OUTPUT51] = 'OSIG_OUTPUT51',
[mc.OSIG_OUTPUT52] = 'OSIG_OUTPUT52',
[mc.OSIG_OUTPUT53] = 'OSIG_OUTPUT53',
[mc.OSIG_OUTPUT54] = 'OSIG_OUTPUT54',
[mc.OSIG_OUTPUT55] = 'OSIG_OUTPUT55',
[mc.OSIG_OUTPUT56] = 'OSIG_OUTPUT56',
[mc.OSIG_OUTPUT57] = 'OSIG_OUTPUT57',
[mc.OSIG_OUTPUT58] = 'OSIG_OUTPUT58',
[mc.OSIG_OUTPUT59] = 'OSIG_OUTPUT59',
[mc.OSIG_OUTPUT60] = 'OSIG_OUTPUT60',
[mc.OSIG_OUTPUT61] = 'OSIG_OUTPUT61',
[mc.OSIG_OUTPUT62] = 'OSIG_OUTPUT62',
[mc.OSIG_OUTPUT63] = 'OSIG_OUTPUT63',

[mc.OSIG_XHOME] = 'OSIG_XHOME',
[mc.OSIG_YHOME] = 'OSIG_YHOME',
[mc.OSIG_ZHOME] = 'OSIG_ZHOME',
[mc.OSIG_AHOME] = 'OSIG_AHOME',
[mc.OSIG_BHOME] = 'OSIG_BHOME',
[mc.OSIG_CHOME] = 'OSIG_CHOME',

[mc.OSIG_HOMED_X] = 'OSIG_HOMED_X',
[mc.OSIG_HOMED_Y] = 'OSIG_HOMED_Y',
[mc.OSIG_HOMED_Z] = 'OSIG_HOMED_Z',
[mc.OSIG_HOMED_A] = 'OSIG_HOMED_A',
[mc.OSIG_HOMED_B] = 'OSIG_HOMED_B',
[mc.OSIG_HOMED_C] = 'OSIG_HOMED_C',

[mc.OSIG_XLIMITMINUS] = 'OSIG_XLIMITMINUS',
[mc.OSIG_YLIMITMINUS] = 'OSIG_YLIMITMINUS',
[mc.OSIG_ZLIMITMINUS] = 'OSIG_ZLIMITMINUS',
[mc.OSIG_ALIMITMINUS] = 'OSIG_ALIMITMINUS',
[mc.OSIG_BLIMITMINUS] = 'OSIG_BLIMITMINUS',
[mc.OSIG_CLIMITMINUS] = 'OSIG_CLIMITMINUS',

[mc.OSIG_XLIMITPLUS] = 'OSIG_XLIMITPLUS',
[mc.OSIG_YLIMITPLUS] = 'OSIG_YLIMITPLUS',
[mc.OSIG_ZLIMITPLUS] = 'OSIG_ZLIMITPLUS',
[mc.OSIG_ALIMITPLUS] = 'OSIG_ALIMITPLUS',
[mc.OSIG_BLIMITPLUS] = 'OSIG_BLIMITPLUS',
[mc.OSIG_CLIMITPLUS] = 'OSIG_CLIMITPLUS',

[mc.OSIG_FEEDHOLD] = 'OSIG_FEEDHOLD',
[mc.OSIG_JOG_INC] = 'OSIG_JOG_INC',
[mc.OSIG_JOG_MPG] = 'OSIG_JOG_MPG',
[mc.OSIG_JOG_CONT] = 'OSIG_JOG_CONT',
[mc.OSIG_JOG_ENABLED] = 'OSIG_JOG_ENABLED',

[mc.OSIG_MACHINE_CORD] = 'OSIG_MACHINE_CORD',
[mc.OSIG_MACHINE_ENABLED] = 'OSIG_MACHINE_ENABLED',

[mc.OSIG_AXIS_SWITCH_START] = 'OSIG_AXIS_SWITCH_START',
[mc.OSIG_AXIS_SWITCH_FINISH] = 'OSIG_AXIS_SWITCH_FINISH',

[mc.OSIG_OUTPUT_START] = 'OSIG_OUTPUT_START',
[mc.OSIG_OUTPUT_FINISH] = 'OSIG_OUTPUT_FINISH',

[mc.OSIG_MISC_START] = 'OSIG_MISC_START',
[mc.OSIG_MISC_FINISH] = 'OSIG_MISC_FINISH',

[mc.OSIG_ENABLE_START] = 'OSIG_ENABLE_START',
[mc.OSIG_ENABLE_FINISH] = 'OSIG_ENABLE_FINISH',

[mc.OSIG_SPINDLEON] = 'OSIG_SPINDLEON',
[mc.OSIG_SPINDLEFWD] = 'OSIG_SPINDLEFWD',
[mc.OSIG_SPINDLEREV] = 'OSIG_SPINDLEREV',

[mc.OSIG_MISTON] = 'OSIG_MISTON',
[mc.OSIG_COOLANTON] = 'OSIG_COOLANTON',

[mc.OSIG_CHARGE] = 'OSIG_CHARGE',
[mc.OSIG_CHARGE2] = 'OSIG_CHARGE2',

[mc.OSIG_LIMITOVER] = 'OSIG_LIMITOVER',
[mc.OSIG_OPT_STOP] = 'OSIG_OPT_STOP',
[mc.OSIG_BLOCK_DELETE] = 'OSIG_BLOCK_DELETE',
[mc.OSIG_TOOL_CHANGE] = 'OSIG_TOOL_CHANGE',
[mc.OSIG_TP_MOUSE_DN] = 'OSIG_TP_MOUSE_DN',
[mc.OSIG_CURRENTHILOW] = 'OSIG_CURRENTHILOW',
[mc.OSIG_DIGTRIGGER] = 'OSIG_DIGTRIGGER',
[mc.OSIG_DIST_TOGO] = 'OSIG_DIST_TOGO',
[mc.OSIG_DWELL] = 'OSIG_DWELL',
[mc.OSIG_REVERSE_RUN] = 'OSIG_REVERSE_RUN',
[mc.OSIG_RUNNING_GCODE] = 'OSIG_RUNNING_GCODE',
[mc.OSIG_SINGLE_BLOCK] = 'OSIG_SINGLE_BLOCK',
[mc.OSIG_SOFTLIMITS_ON] = 'OSIG_SOFTLIMITS_ON',

[mc.SIG_TYPE_NONE] = 'SIG_TYPE_NONE',
[mc.SIG_TYPE_INPUT] = 'SIG_TYPE_INPUT',
[mc.SIG_TYPE_OUTPUT] = 'SIG_TYPE_OUTPUT',

[mc.MSG_SIG_CHANGED] = 'MSG_SIG_CHANGED',
}

if(SigLib[sig] ~= nil)then
local sigName = sigNames[sig] or sig;
mc.mcCntlSetLastError(inst,'State - '..sigName..' = '..tostring(state));
SigLib[sig](state);  -- comment out if you don't have any SigLib definitions in your screen startup script.
end

this is the startup and a gcode file run
Though did just notice that the M30 does not turn off the spindle
Update: found it is possible to create a M30 macro and solve that issue.  ;)

Code: [Select]
State - SIG_TYPE_OUTPUT = 0
State - ISIG_INPUT2 = 0
State - ISIG_INPUT3 = 0
State - ISIG_INPUT4 = 0
State - ISIG_INPUT5 = 0
State - ISIG_INPUT6 = 0
State - ISIG_INPUT7 = 0
State - ISIG_INPUT8 = 0
State - ISIG_INPUT13 = 0
State - ISIG_INPUT14 = 0
State - ISIG_INPUT15 = 0
State - OSIG_RUNNING_GCODE = 0
State - OSIG_MACHINE_ENABLED = 0
State - OSIG_MACHINE_ENABLED = 1
Do Cycle Start
State - OSIG_RUNNING_GCODE = 1  
State - OSIG_RUNNING_GCODE = 0
Title: Re: Signal Scripts
Post by: TimGS on May 06, 2015, 10:56:51 AM
Could you explain what is meant by the [] = assignment?  Thank You
Title: Re: Signal Scripts
Post by: TimGS on May 06, 2015, 11:17:19 AM
Found it...

Suppose you want to list all identifiers used in a program source; somehow you need to filter the reserved words out of your listing. Some C programmers could be tempted to represent the set of reserved words as an array of strings, and then to search this array to know whether a given word is in the set. To speed up the search, they could even use a binary tree or a hash table to represent the set.

http://www.lua.org/pil/11.5.html (http://www.lua.org/pil/11.5.html)

In Lua, an efficient and simple way to represent such sets is to put the set elements as indices in a table. Then, instead of searching the table for a given element, you just index the table and test whether the result is nil or not. In our example, we could write the next code:
    reserved = {
      ["while"] = true,     ["end"] = true,
      ["function"] = true,  ["local"] = true,