Author |
|
TexanHogman Newbie
Joined: March 15 2011
Online Status: Offline Posts: 2
|
Posted: March 15 2011 at 21:53 | IP Logged
|
|
|
I have a macro that can be in several wait states. What I want is the ability to interrupt the wait so that it will resume the next operation in the macro.
The use case is irrigation control (copied from a post by Dave some time ago). I want to be able to have another macro to skip a zone in a program. My irrigation programs are working great just want to support a "skip zone"
hope this is an easy one -- didn't see anything obvious by searching.
Thanks
TexanHogman
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: March 16 2011 at 00:29 | IP Logged
|
|
|
There is a ph_killmacrowait("id")
__________________ Lee G
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: March 16 2011 at 07:43 | IP Logged
|
|
|
Lee, that works great but it will terminate the whole macro. I believe he wants to kill an individual wait and continue the macro. That would be a nice feature. Maybe there’s a SQL command.
Edited by BeachBum - March 16 2011 at 07:45
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: March 16 2011 at 09:09 | IP Logged
|
|
|
Change the exiting Macro Wait to a ph_macro("WAITHERE"). Macro "WAITHERE" issues the wait. Now issue the ph_killmacrowait("WAITHERE"). That would cancel the Wait and return control to the next Macro statement in the original Macro. Have not actually tested this.
__________________ Lee G
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: March 16 2011 at 10:02 | IP Logged
|
|
|
Great idea BUT it did not work. The wait gives control back to the issuing macro. So I tried Submacro and that held it but kill terminated the whole macro.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: March 16 2011 at 12:20 | IP Logged
|
|
|
Try this idea.. You could use a System Global and have a Goto Label as your 1st statement. You would load the Global with your wait return point. Then instead of issuing a Wait create a Timed Event that would bring you back to the macro which then would Goto to your last next sequential instruction. If you want to interrupt the pseudo wait have a routine that would modify the Timed Event you created. And as Lee said I have not tested this but it may be worth a try.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 16 2011 at 14:15 | IP Logged
|
|
|
I looked at this and thought "Why didnt I think of this. This would be a great feature". Well, it appears I already had thought of it . Just use the ph_extendmacrowait function. If the ID of your macro is "MACROID", then the proper format would be:
ph_extendmacrowait("MACROID",0,0)
This will instantly expire the macro and allow execution to continue. You can also pass negative values in the second parameter to "unextend" a macro's wait time.
Great thinking on some of the ways to achieve this though .
Dave.
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: March 16 2011 at 14:24 | IP Logged
|
|
|
dhoward wrote:
You can also pass negative values in the second parameter to "unextend" a macro's wait time.
|
|
|
I should have played in the sand box… Did not know about the neg #....
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
TexanHogman Newbie
Joined: March 15 2011
Online Status: Offline Posts: 2
|
Posted: March 16 2011 at 21:40 | IP Logged
|
|
|
Dave -- works like a charm -- well done on the forward thinking.
Thanks to all for the suggestions too.
Edited by TexanHogman - March 16 2011 at 21:41
|
Back to Top |
|
|