Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: peter g on August 27, 2021, 09:04:03 AM

Title: Mach4 Enable/Disable Script
Post by: peter g on August 27, 2021, 09:04:03 AM
Hey Everyone,

I would like 2 physical button 1 to enable and the other to disable. These would replicated the onscreen "Enable" and "Disable" button in mach4. Is there a script to assign one of the inputs in Mach 4 to be an "Enable" button?

Peter
Title: Re: Mach4 Enable/Disable Script
Post by: Cbyrdtopper on August 27, 2021, 10:06:54 AM
I use one button to toggle enable on the control panels here in the shop.
Just put the code in the signal library in the screen load script.
I modified my code so one input will enable mach and the other will disable mach.

[mc.ISIG_INPUT6] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,1)
   end
end,

[mc.ISIG_INPUT7] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,0)
   end
end,
Title: Re: Mach4 Enable/Disable Script
Post by: peter g on August 27, 2021, 11:57:04 AM
I use one button to toggle enable on the control panels here in the shop.
Just put the code in the signal library in the screen load script.
I modified my code so one input will enable mach and the other will disable mach.

[mc.ISIG_INPUT6] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,1)
   end
end,

[mc.ISIG_INPUT7] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,0)
   end
end,

Thanks for you help this worked.

Do you know if its possible to do the same for M07(mist on) M08(coolant on) M09(off)?

Peter
Title: Re: Mach4 Enable/Disable Script
Post by: peter g on August 27, 2021, 02:20:45 PM
Hi,

Never mind I found a script for it.

Peter
Title: Re: Mach4 Enable/Disable Script
Post by: Cbyrdtopper on August 27, 2021, 04:13:46 PM
There is a lot you can do with the signal library with inputs. I use the same button to toggle enable, spindle, coolant, and the keyboard. I also have a button for reset, cycle start, and feedhold.