Welcome, Guest. Please login or register.
Did you miss your activation email?
December 12, 2017, 12:35:03 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  FAQs
| | |-+  Mach4 ESS Signal Script for Estop Noob ?
Pages: 1   Go Down
Print
Author Topic: Mach4 ESS Signal Script for Estop Noob ?  (Read 613 times)
0 Members and 1 Guest are viewing this topic.
lrid
Holding

Offline Offline

Posts: 2


View Profile
« on: April 16, 2017, 07:46:12 PM »

Hi everyone
This is probably a really easy fix but what i am trying to do is get a signal output when the Estop state changes. I would easily wire the estop to the the indicator but the logic is reversed for the Estop switch. So the system is a ESS the Estop switch functionality works in MACH4 with the diagnostics, i did setup the profile using the setup from ESS then i changed the panel load to be wx4 as stated in other posts to enable the signal script. i have the output signal tied to Output0 on MACH and mapped to port2pin1. the start script is below i do not see, any indication that the change is happening in diagnostics nor do i see it on a meter the code below is only that function

Code:
inst = mc.mcGetInstance()

---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
[mc.OSIG_MACHINE_ENABLED] = function (state)
    machEnabled = state;
    ButtonEnable()
end,

--[mc.ISIG_INPUT0] = function (state)
 --       mc.OSIG_OUTPUT0 = state
--end,

--[mc.ISIG_INPUT1] = function (state)
 --   mc.OSIG_OUTPUT0 = state
   -- if (state == 1) then   
--        CycleStart()
--    --else
--        --mc.mcCntlFeedHold (0)
--    end

--end,
[mc.ISIG_EMERGENCY] = function (state)
    mc.OSIG_OUTPUT0 = state
end,

[mc.OSIG_JOG_CONT] = function (state)
    if( state == 1) then
       scr.SetProperty('labJogMode', 'Label', 'Continuous');
       scr.SetProperty('txtJogInc', 'Bg Color', '#C0C0C0');--Light Grey
       scr.SetProperty('txtJogInc', 'Fg Color', '#808080');--Dark Grey
    end
end,

[mc.OSIG_JOG_INC] = function (state)
    if( state == 1) then
        scr.SetProperty('labJogMode', 'Label', 'Incremental');
        scr.SetProperty('txtJogInc', 'Bg Color', '#FFFFFF');--White   
        scr.SetProperty('txtJogInc', 'Fg Color', '#000000');--Black
   end
end,

[mc.OSIG_JOG_MPG] = function (state)
    if( state == 1) then
        scr.SetProperty('labJogMode', 'Label', '');
        scr.SetProperty('txtJogInc', 'Bg Color', '#C0C0C0');--Light Grey
        scr.SetProperty('txtJogInc', 'Fg Color', '#808080');--Dark Grey
        --add the bits to grey jog buttons becasue buttons can't be MPGs
    end
end,


--M6 messagebox
[mc.OSIG_TOOL_CHANGE] = function (state)
    local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = mc.mcToolGetCurrent(inst)

if (selectedtool ~= currenttool) then
        if( state == 1) then
            mm.ToolChangeMsg("A tool change has been requested via M6. Change your tool then press Cycle Start to continue!", "Tool Change Active!")
        end
    end
end
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!