Main screen Mist control - custom macro

If you have a question about the software please ask it here.

Main screen Mist control - custom macro

Postby ralphie79 » Fri Jul 10, 2020 12:38 pm

Hi,

Just wondering if you can change the macro / code for the main buttons on the main screen for mist control.

I have a festo relay for the control of my mist which has 2 relays, one for turning it on and another for off.

I have them set up so that the on is the mist / M7 and off is the flood / M8. To make sure I don't burn the relays out the buttons need to be pressed twice in order for them to turn on then off.

I have a macro set up on M7.txt to do this;
Code: Select all
exec.Miston();
exec.Code("G4 P500");
exec.Stopcoolant();


How can I change the main screen button to run this instead of pressing it twice as it won't run the macro in my profile...?

After doing some research i'm thinking I may need to edit the screen and put a button over the top of the mist/flood and possibly have it so that when I toggle it, it runs the M7 macro once, then the M8 macro on the toggle. Just thought I might try here to see if anyone might be able to help.


Thanks,

Ralph.
ralphie79
 
Posts: 3
Joined: Fri Jul 10, 2020 11:52 am
Location: Australia

Re: Main screen Mist control - custom macro

Postby Robertspark » Fri Jul 10, 2020 4:21 pm

Normally you use M7 for Mist ON, M8 for Flood ON and M9 to turn them both (or whichever is on OFF).

The screen button is a toggle button, so that if you press Mist, it will go on and if you press it again it will go off....... same with Floor screen button.

You can create a custom macro and give it a custom button number object of 20000 and above (I think up to 21999) and then include some code to run the mist when it is on and flood when it is off....... BUT the problem is how would you turn both off?

Once you've turned on the mist..... and then flipped back to flood..... how would you turn the flood off as you will just flip it to mist?

You can setup a macro which can only allow one status, I.e it will block the other from operating if the other is still in the ON state....... that would be don't through changing both on screen buttons to 20000 and 20001 and a separate macroloop to monitor the status of those buttons / any flags set and block the other one from operating until that button is cleared.

Like I asked above......
Once you've turned on the mist..... and then flipped back to flood..... how would you turn the flood off as you will just flip it to mist?

As that is not clear to me how you want it to work
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Main screen Mist control - custom macro

Postby Robertspark » Fri Jul 10, 2020 4:30 pm

ralphie79 wrote:Hi,

I have a macro set up on M7.txt to do this;
Code: Select all
exec.Miston();
exec.Code("G4 P500");
exec.Stopcoolant();





Also this macro is not very clever in my opinion, because it puts the machine is a whole wait cycle for 500 (seconds I presume) before doing anything else

Normally you could try to use the

Code: Select all
Thread.Sleep(500);


instead of

Code: Select all
exec.Code("G4 P500");

if it doesn't work, then you would need to use the #Events and a while statement to all the Thread.Sleep(500); to work [it gets a little more complicated]
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Main screen Mist control - custom macro

Postby ralphie79 » Sun Jul 12, 2020 11:02 am

Thanks for the reply.

I think I may not have explained the relay properly.

The relay on one side of the air switch needs the m7 to turn the mist on, then I wait a little to use the m9 to turn the relays off. The mist is running now. To stop the mist I need to use the m8 to turn the other relay on which closes the air switch, wait a little then use m9 to turn the relays off. Mist has now stopped.

I was hoping that I could have my two m7 and m8 custom macros on the one toggle switch.

I will take on the advice for the thread.Sleep and try my hand at setting up a button with the custom macro on button 2xxxx. I only had a few holes to drill on each section so the g4 pause wasn't really a big issue for me. I'll post how I went tomorrow when I get it going... think I have a little idea of what I need to do now.

Thanks,

Ralph
ralphie79
 
Posts: 3
Joined: Fri Jul 10, 2020 11:52 am
Location: Australia

Re: Main screen Mist control - custom macro

Postby laki » Sun Jul 12, 2020 12:17 pm

If I'm wrong you need something like this.

Code: Select all
bool buttonstate = AS3.Getbuttonstate(21030);

if (!buttonstate)
    {
   AS3.Switchbutton(true,21030);   
   exec.Setoutpin(3, 1);
   Thread.Sleep(2500);
   exec.Clroutpin(3, 1);
    }
else

    {
    AS3.Switchbutton(false,21030);
    exec.Setoutpin(3, 4);
    Thread.Sleep(2500);
    exec.Clroutpin(3, 4);
    }

M21030.txt
(330 Bytes) Downloaded 376 times
laki
 
Posts: 111
Joined: Thu Jul 19, 2018 12:46 am
Location: Belgrade, Serbia

Re: Main screen Mist control - custom macro

Postby ralphie79 » Tue Jul 14, 2020 12:20 am

If I'm wrong you need something like this.


Certainly not wrong.... Exactly what I need. Just added it now and tested it off line, but looks like it should be right.

Thanks for the help!
ralphie79
 
Posts: 3
Joined: Fri Jul 10, 2020 11:52 am
Location: Australia


Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 26 guests

cron