Hello Guest it is April 19, 2024, 03:37:00 AM

Author Topic: Mach4 Coolant Toogle Problems  (Read 3360 times)

0 Members and 1 Guest are viewing this topic.

Offline thosj

*
  •  532 532
    • View Profile
Re: Mach4 Coolant Toogle Problems
« Reply #10 on: January 03, 2019, 02:25:45 PM »
Daniba,

Do you mean you copied and pasted MY code from above? Into the Signal Library of the Screen Start script? If so, I don't know why it works for me and not for you. The only thing I can think of, is that's a TOGGLE script. I have a MOMENTARY switch wired to the Mach4/PoKeys input. Each press of the button TOGGLES the coolant. If you have a regular switch in there you might need different code that doesn't toggle but simply switches the coolant ON in one state of the switch and OFF in the other.

I could, of course, completely misunderstand what you're trying to do/doing. If so, disregard.

Tom
--
Tom
Re: Mach4 Coolant Toogle Problems
« Reply #11 on: January 03, 2019, 03:08:09 PM »
I have a CSMIO / IP-S.
the button works!
only drawback is that it starts in ON state when I start Mach4.
E-STOP also has no effect on the status.

Offline thosj

*
  •  532 532
    • View Profile
Re: Mach4 Coolant Toogle Problems
« Reply #12 on: January 03, 2019, 04:34:41 PM »
Do you have a momentary switch or an on/off switch? It's not some sort of normally closed momentary switch by any chance, is it? Most are normally open. If it is, you might have to change the code state to "if (state == 0) then", but I'm not sure if that would work.

Mine starts in the OFF state. Pressing the button turns in on, pressing it again turns it off. My switch is a normally OPEN momentary switch.

Disconnect your switch, does it still startup in the ON position? Did it startup in the ON position before you put the code in the screen start script? IF NO, then it's the switch somehow, isn't it?

Tom
--
Tom

Offline thosj

*
  •  532 532
    • View Profile
Re: Mach4 Coolant Toogle Problems
« Reply #13 on: January 03, 2019, 04:48:57 PM »
Also, on Mach4's diagnostic tab, is the input of your switch lit up on startup? If so, then the switch is closed or maybe you could change Active HIGH/LOW on your input to reverse it?? Grasping at straws here!!!

Tom
--
Tom
Re: Mach4 Coolant Toogle Problems
« Reply #14 on: January 03, 2019, 06:28:53 PM »
Daniba73,
You have to make your e stop shut off outputs.
Put the input in your Signal Library just like an input. 
Then put the conditions, if E Stop = true or 1 then Turn stuff off.
Chad Byrd
Re: Mach4 Coolant Toogle Problems
« Reply #15 on: January 04, 2019, 06:06:35 AM »
Hi,
even reversing the high / low status in Mach4 is not good.
the pump starts up until Mach4 is not active, then goes off.
this is the code.



----------Toggle Coolant M8----------------
[mc.ISIG_INPUT7] = function (state)
if (state == 0) then
     local inst = mc.mcGetInstance();
     local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON);
     local sigState = mc.mcSignalGetState(sigh);
     if (sigState == 0) then
         local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
         mc.mcSignalSetState(OSigCool,1)
         mc.mcCntlSetLastError(inst, "Coolant On")
     else
         local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
         mc.mcSignalSetState(OSigCool,0)
         mc.mcCntlSetLastError(inst, "Coolant Off")
     end
end
   
end,
Re: Mach4 Coolant Toogle Problems
« Reply #16 on: January 04, 2019, 08:28:06 AM »
Hang on,
If you close Mach4 does the coolant turn on?   
And when you open Mach4, does the coolant stay on until the program has fully loaded?
Chad Byrd
Re: Mach4 Coolant Toogle Problems
« Reply #17 on: January 04, 2019, 10:06:31 AM »
when I open Mach4, M8 activates itself.
if I close Mach4, M8 goes off.
Re: Mach4 Coolant Toogle Problems
« Reply #18 on: January 04, 2019, 10:45:27 AM »
Change this...

[mc.ISIG_INPUT7] = function (state)
if (state == 0) then

to this   Change the condition:  State == 1

[mc.ISIG_INPUT7] = function (state)
if (state == 1) then
Chad Byrd
Re: Mach4 Coolant Toogle Problems
« Reply #19 on: January 04, 2019, 11:01:48 AM »

It was the first change I made, but without success.