Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Help Debugging and General Know-How Gaps. Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
syonker
Senior Member
Senior Member
Avatar

Joined: March 06 2009
Location: United States
Online Status: Offline
Posts: 212
Posted: September 24 2010 at 10:48 | IP Logged Quote syonker

Hi Gang,

Two things that elude me are 1) Program Logic and 2) Debugging tips/hints. So that said, let me ask the following questions in an effort to "Learn to Fish"...:

1) Is there a "step" function when running a macro that allows you to see I/O, and errors?
2) Is there a log or something with error codes, and a place to look them up?
3) Has anyone written a Programmer's Guide that would show examples of logic and flow control, etc?

...and of course, I have a specific problem to deal with...this Macro is throwing a Syntax Error...can anyone see the obvious problem, because I sure don't - I've compared it to other macros in my line-up, and to examples on the board...



__________________
"I will consider myself having succeeded when my house becomes sentient and attempts to kill me."

><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.

·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
Back to Top View syonker's Profile Search for other posts by syonker Visit syonker's Homepage
 
syonker
Senior Member
Senior Member
Avatar

Joined: March 06 2009
Location: United States
Online Status: Offline
Posts: 212
Posted: September 24 2010 at 11:11 | IP Logged Quote syonker

I should state that the Goto Label function with both results going to "FANON" is on purpose...either way, it runs through "FANOFF" - even in this case.

__________________
"I will consider myself having succeeded when my house becomes sentient and attempts to kill me."

><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.

·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
Back to Top View syonker's Profile Search for other posts by syonker Visit syonker's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: September 24 2010 at 11:20 | IP Logged Quote grif091

Unless there is some function in the Macro that is not working the way you want it to ignore the syntax error message in the event log. There is a known problem with the Insteon command for commands that do not have a cmd2 value (such as Fast On and Fast Off). PH2 is trying to validate cmd2 when no value can be specified.

No single step function that I know of.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
syonker
Senior Member
Senior Member
Avatar

Joined: March 06 2009
Location: United States
Online Status: Offline
Posts: 212
Posted: September 24 2010 at 11:35 | IP Logged Quote syonker

grif091 - THANK YOU SO MUCH! I was pulling my hair out on this one - the Macro WORKS....I changed it to use Jump Commands because I simply couldn't see the error and whether it was in the logic of the labels, gotos, formulas, etc. Here's what I have now and it seems to work fine:



__________________
"I will consider myself having succeeded when my house becomes sentient and attempts to kill me."

><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.

·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
Back to Top View syonker's Profile Search for other posts by syonker Visit syonker's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: September 24 2010 at 11:56 | IP Logged Quote TonyNo

FYI, labels themselves don't get quotes.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: September 24 2010 at 12:03 | IP Logged Quote grif091

Tony found the problem with the Label/Goto Label. No quotes on the Label statement, quotes on the Goto Label string.

Label/Goto Label tends to be a better approach in most Macros because they are not affected by changes to the Macro over time the way Jump line numbers are.

Sorry I missed the quotes on the Label statements.


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
syonker
Senior Member
Senior Member
Avatar

Joined: March 06 2009
Location: United States
Online Status: Offline
Posts: 212
Posted: September 24 2010 at 12:04 | IP Logged Quote syonker

TonyNo and Grif - Thanks again - I didn't find anything about whether quotes around labels were required...I'd seen macros both ways...this is very valuable information.

__________________
"I will consider myself having succeeded when my house becomes sentient and attempts to kill me."

><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.

·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
Back to Top View syonker's Profile Search for other posts by syonker Visit syonker's Homepage
 
syonker
Senior Member
Senior Member
Avatar

Joined: March 06 2009
Location: United States
Online Status: Offline
Posts: 212
Posted: September 24 2010 at 12:49 | IP Logged Quote syonker

Ok, one last posting - based on the information you two provided (for which I am EXTREMELY THANKFUL), I re-built the macro like this, with some messaging so I can see the status changing along the way:



__________________
"I will consider myself having succeeded when my house becomes sentient and attempts to kill me."

><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.

·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
Back to Top View syonker's Profile Search for other posts by syonker Visit syonker's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: September 24 2010 at 13:18 | IP Logged Quote grif091

Dave offered a suggestion regarding Labels that I have found useful.   Because a Goto Label for a label that does not exist does NOT result in a syntax error you can code   if(x=y, “TrueLabel”, “Next”) where “Next” has not been defined.   The effect is a True condition goes to the TrueLabel, a False condition falls through to the next sequential Macro statement.   Avoids having to define a Label to execute the next sequential statement on the False condition.

GoTo Label    If (x=y,”TrueLabel”, “Next”)
next sequential Macro line executed when the If condition is False
Label   True Label   

The Skip column is also useful. Once the Macro has been defined and debugged the User Message statements can be eliminated by checking the Skip column for those statements. The messages can be restored if further debug is necessary in the future simply by removing the check in Skip.




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

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