Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: How to interrupt a wait? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TexanHogman
Newbie
Newbie


Joined: March 15 2011
Online Status: Offline
Posts: 2
Posted: March 15 2011 at 21:53 | IP Logged Quote TexanHogman

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 View TexanHogman's Profile Search for other posts by TexanHogman
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: March 16 2011 at 00:29 | IP Logged Quote grif091

There is a ph_killmacrowait("id")

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 16 2011 at 07:43 | IP Logged Quote BeachBum

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 View BeachBum's Profile Search for other posts by BeachBum
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: March 16 2011 at 09:09 | IP Logged Quote grif091

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 View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 16 2011 at 10:02 | IP Logged Quote BeachBum

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 View BeachBum's Profile Search for other posts by BeachBum
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 16 2011 at 12:20 | IP Logged Quote BeachBum

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 View BeachBum's Profile Search for other posts by BeachBum
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 16 2011 at 14:15 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 16 2011 at 14:24 | IP Logged Quote BeachBum

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 View BeachBum's Profile Search for other posts by BeachBum
 
TexanHogman
Newbie
Newbie


Joined: March 15 2011
Online Status: Offline
Posts: 2
Posted: March 16 2011 at 21:40 | IP Logged Quote TexanHogman

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 View TexanHogman's Profile Search for other posts by TexanHogman
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum