Please login or register.

Login with username, password and session length

Author Topic: Else problem  (Read 7095 times)

emil

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 100
Else problem
« on: April 26, 2007, 07:47:09 AM »

I encountered a bug last night that someone mentioned here that for the life of me I can't find the post.
It seems the else condition doesn't operate properly, both branches are executed.

i.e.
IF A3 turns off
    IF flag 2 set
        clear flag 7
        dim light 50%
    ELSE
        clear flag 7
        turn off light   

LIGHT DIMS THEN TURNS OFF - this is incorrect!

When I watch the light I see it dim down then about 1 sec. later it turns off !
I simply flipped the flag clear and light operation in both branches and it works now

IF A3 turns off
    IF flag 2 set
        dim light 50%
        clear flag 7
    ELSE
        turn off light   
        clear flag 7

LIGHT DIMS - this is correct!

I wanted to find the post to see if there is more insight on this problem and if others had the problem. (v3.203)

Thanks
Logged
ActiveHomePro 3.310
SmartMacros 3.310

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Else problem
« Reply #1 on: April 26, 2007, 08:20:05 AM »

Not knowing what flag 7 is used for only tells us 1/2 the story! ::) ;)
The placement of flags in a macro is key, They can cause different out comes based on where you place them in a macro!
So stating it is a bug isn't entirely true, you just discovered the correct placement for that flag based on where else you have it(flag 7) in your setup! ;) :D ;D
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

TakeTheActive

  • Hero Member
  • *****
  • Helpful Post Rating: 126
  • Posts: 1047
  • Old !@#$% Tinkerer!
Re: ELSE Problem
« Reply #2 on: April 26, 2007, 09:06:16 AM »


I encountered a bug last night that someone mentioned here that for the life of me I can't find the post.

How about:

Logged
Low Post Count != Low Knowledge - High Post Count != High Knowledge ;)

ADVICE TO X-10 NEWBIES FROM AN X-10 OLD-TIMER

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Else problem
« Reply #3 on: April 26, 2007, 09:45:08 AM »

I'd be curious if the dim command is affecting your results. AHP has some known problems executing commands after dims.

i.e. I'd be curious if either of these scenarios works.

IF A3 turns off
    IF flag 2 set
        clear flag 7
        dim light 50%
        delay 2 sec
    ELSE
        clear flag 7
        turn off light   


Or this scenario...

IF A3 turns off
    IF flag 2 set
        clear flag 7
        P1 on                ;Where P1 is any other HC that you use
    ELSE
        clear flag 7
        turn off light   
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

emil

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 100
Re: Else problem
« Reply #4 on: April 26, 2007, 11:06:38 AM »

Quote
Not knowing what flag 7 is used for only tells us 1/2 the story!   
The placement of flags in a macro is key, They can cause different out comes based on where you place them in a macro!
So stating it is a bug isn't entirely true, you just discovered the correct placement for that flag based on where else you have it(flag 7) in your setup!   
Flag 7 is used to eliminate repeated entries when A3 turns on. So when A3 turns on flag 7 is set.

What Flag 7's function was did not seem relevant to the operation of the macro, it was just the fact that I was clearing a flag right after a condition (I think).

Putting the flag operation after the on or dim command fixed the "feature" (not bug :) ).


IF we could only get some sort of functional description on how the CM15a works internally we could easily work around these nuances.

Again, I could have sworn I saw somewhere on this forum someone mentioning about both parts of the macro being called. It was like a tips thing, I'll keep looking.

Thanks for the help guys.
Logged
ActiveHomePro 3.310
SmartMacros 3.310

Walt2

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 28
  • Posts: 787
Re: Else problem
« Reply #5 on: May 09, 2007, 01:03:10 PM »


It seems the else condition doesn't operate properly, both branches are executed.

i.e.
IF A3 turns off
    IF flag 2 set
        clear flag 7
        dim light 50%
    ELSE
        clear flag 7
        turn off light   


From my experiences, the "safe" way to program it is...

IF A3 turns off
    IF flag 2 set
        clear flag 7
        dim light 50%
    ELSE IF flag 2 reset
        clear flag 7
        turn off light   

Yea, I know that logically, the ELSE should only be executed if flag 2 was reset (ie, not set), but it doesn't hurt to verify it (and sometimes it even makes AHP do the right thing).

I have learned the hard way, and now all my ELSE macros re-check conditions.
« Last Edit: May 09, 2007, 01:05:19 PM by Walt2 »
Logged
* Sears Home Control System, Radio Shack Plug 'n Power, NuTone, Stanley LightMaker, BSR, HomeLink.
* Tecmar Device Master, CP290 (LightHouse), CM11A (AH), CM14A (AH2), CM15A (AHPro).
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.