Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Toecutter on February 23, 2024, 12:56:33 PM

Title: External Button Script for 5036
Post by: Toecutter on February 23, 2024, 12:56:33 PM
Hello,
I changed from version 4612 to version 5036. Is it possible that with this version the script for controlling the external cycle start and stop buttons no longer works?
If I insert lines like I always did with version 4612, the machine stops with "Feed Hold" after the automatic tool change. Can anyone explain to me?

Thank you, greetings René

The Code is:

mc.ISIG_INPUT0] = function (state)
     if (state == 1) then   
        CycleStart()
    end
end,

[mc.ISIG_INPUT1] = function (state)
    if (state == 1) then   
        mc.mcCntlFeedHold (inst)
        mc.mcCntlSetLastError(inst, "Do Feed Hold")
    end
end,

[mc.ISIG_INPUT2] = function (state)
     if (state == 1) then 
        CycleStop()
    end
end,
Title: Re: External Button Script for 5036
Post by: Toecutter on February 25, 2024, 02:06:49 PM
I commented out the following lines and now it works again, no idea why.


[mc.ISIG_INPUT1] = function (state)
    if (state == 1) then   
        mc.mcCntlFeedHold (inst)
        mc.mcCntlSetLastError(inst, "Do Feed Hold")
    end
end,
Title: Re: External Button Script for 5036
Post by: GOOMBA on April 01, 2024, 10:20:23 AM
I would guess

inst

is nil
ensure you have

inst = mc.mcCntlGetInstance()

before that call and it will likely work.