Author |
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 08 2009 at 12:24 | IP Logged
|
|
|
I'm having trouble getting a reliable reading from my
Insteon Thermostat and am attempting to retry "bad"
readings, but can't figure out how to JUMP properly.
It appears there are two ways to "Jump" by either using
the "JUMP" command in the macros Command Field (but then
how does one specify the jump value?). The doco is
quite confusing.
I've also seen a "JUMP" function as part of an actual
macro command in a forum example, but couldn't determine
how it works and there is no mention in any doco I can
find....
BTW is there any better documentation anywhere yet? I
keep looking but can only find a 2006 User Manual which
is pretty much out of date.
Can anyone give me a example of an actual JUMP bit of
coding to get me going?
As always---Thanks
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 08 2009 at 13:22 | IP Logged
|
|
|
JUMP just needs the number of lines to jump.
Example:
10 Comment Start Here
20 Jump 2
30 Comment This will be jumped over
40 Comment Here is where the jump will land
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: January 08 2009 at 14:29 | IP Logged
|
|
|
I'd strongly recommend using the "GOTO" command instead - that way when you insert steps you don't have to change all of your Jumps
From the other Tony's example:
10 Comment Start Here
20 Goto "Continue"
30 Comment This will be jumped over
40 Label Continue
50 Comment Here is where the goto will land
Only thing to be careful about is that the goto command expects a string so you need quotes around the label name, while the label definition does not need quotes.
Have fun, Tony
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 08 2009 at 20:51 | IP Logged
|
|
|
Thanks guys -
But I'm still at a loss. Both of the above solutions
appear to be static jumps. I need a computed jump.
I want to Jump on conditional results. Thus I was
looking for something like
JUMP(a>2,1,5)
where if true it would jump 1 (to the next line), or
down 5 lines on FALSE.
Is there such an animal?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 08 2009 at 21:28 | IP Logged
|
|
|
To be specific... I tried something like this but it
doesn't work. Is there an equivalent that does work?
if({FLAG}=1,Goto "DOIT",Goto "RETRY")
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 08 2009 at 21:58 | IP Logged
|
|
|
You need to do it this way...
20 GOTO if( {FLAG}=1, "DOIT", "RETRY")
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 08 2009 at 22:12 | IP Logged
|
|
|
Ah ha!
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 08 2009 at 22:21 | IP Logged
|
|
|
TonyNo wrote:
You need to do it this way...
20 GOTO if( {FLAG}=1, "DOIT", "RETRY") |
|
|
When I do that (substituting one of my valid GLOBAL vars
for FLAG) I get a formula evaluation return of "!" when
I try to verify the formula.
That would make me think it doesn't work, or is that
just the case when trying to validate GOTOs?
These are the kinds of errors that drive me up the wall.
I don't mind struggling when I'm doing something wrong,
but when it seems like all is well and it still doesn't
work, I want to pull hair! Unfortunately I'm bald so
that isn't even an option
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: January 09 2009 at 02:49 | IP Logged
|
|
|
Post your macro statement. This works in my Goto Label .....
(if (ph_getglobal_s("GVSTATE")="DONE","ENDMACRO","CONTINUE"))
__________________ Lee G
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 09 2009 at 10:00 | IP Logged
|
|
|
Lee-
Thanks! Sometimes the most obvious is also the most
obscure!
I've been automatically selecting "Function" for the
Macro Command field for so long I just automatically did
that, instead of the proper JUMP or GOTO LABEL choice.
So of course my jumping efforts were failing.
Your inclusion of
Quote:
This works in my Goto Label
..... |
|
|
was a proper dope slap for me and cleared
up the problem.
At last I have a recursive routine that keeps reading my
Insteon Thermostat until it gets a valid data set. The
STAT seems to be the most un-reliable Insteon device I
have, even though it is located only 3 feet from an
Access Point repeater.
Now I think I can get good data (or die trying!)
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|