Please login or register.

Login with username, password and session length
Advanced search  

News:

The X10Hub (PiX10Hub) is here! Created by the Community, for the Community.:)% #:)

Author Topic: Flags and Else Statements Don't Work  (Read 10211 times)

Ant

  • Guest
Flags and Else Statements Don't Work
« on: April 17, 2005, 12:35:16 PM »

I have simple 'Smart' Macro which is not
working.  I use a trigger C1 ON to detect
whether a flag is set.  If it is not set,
then the macro set it ON, if not a
supersocket is switched on.

Trigger C1 OFF clears the flag.

The Supersocket should only be switched on
if the Flag is already set ON i.e; when the
ELSE condition is encountered to the
question is the flag OFF.  However, the
macros executes BOTH conditions i.e; the
flags is set AND the socket is switched on
every time!

I have set a test flag on the ELSE
condition to confirm that the processing is
performing this function and this is in
fact set.

The processing is being run through the
hardware.

Any help would be appreciated...this is day
one of testing this product with the
simplest of tasks.....

Thanks
Logged

Ant

  • Guest
Re: Flags and Else Statements Don't Work
« Reply #1 on: April 17, 2005, 01:05:08 PM »

I have just switched the Macro around and
set the Flag in the ELSE condition and that
seems to work.

It looks as though a flag status set in the
original condition in response to a test of
that status being OFF, is then carried
forward to the Else statement where the
status is now ON and thus both the original
and ELSE conditions prove to be true.

The macro does not seem to terminate after
the first condition and flag is set.

X10, this is not the way it should work??!@

Any feedback is appreciated on your
experiences.

Cheers.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 264
  • Posts: 9423
  • I don't work for X10, I use it successfuly!
    • Tuicemen Software
Re: Flags and Else Statements Don't Work
« Reply #2 on: April 17, 2005, 04:34:20 PM »

Which flag are you using? flag 1,15&16 were
used by AHP in versions prior to 3.183 X10
states that it is OK to use 1 however 15 &16
are used by the dusk dawn settings in AHP. I
myself can't get Flag 1 to work properly in
macros.Flags 2-14 I have no problems with.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum

martin

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 125
Re: Flags and Else Statements Don't Work
« Reply #3 on: April 17, 2005, 05:06:55 PM »

I have no problems with the use of flags
too (I don't use 1, 15 & 16). Keep in mind
that the macro will stop checking "Else" as
soon as it finds a condition being true.
Logged

david k

  • Sr. Member
  • ****
  • Helpful Post Rating: 0
  • Posts: 126
Re: Flags and Else Statements Don't Work
« Reply #4 on: April 17, 2005, 06:48:03 PM »

If a flag is changed in one part of a
macro, it should be changed in the later
part of the macro.  These are just boolean
variables and when one is cleared or set,
it should be cleared or set from that time
forward.
Logged

Ant

  • Guest
Re: Flags and Else Statements Don't Work
« Reply #5 on: April 18, 2005, 04:03:45 PM »

Thanks for the replies chaps.

I did avoid the use to the flags you
suggest, but still have an issue with the
ELSE statement.

Martin, you say that once a TRUE condition
is encountered then the Macro should stop
checking any futher ELSE conditions.
However, a TRUE condition is encountered in
the first step, a Flag Set, but the Macro
then checks the next ELSE statement instead
of terminating. At this point, it then
encounters another TRUE statement as the
Flag (set in step 1) now concurs with the
ELSE condition in Step 2!

Does any one have issues with Delays in
Smart macros or with regular AHP?  I find
they are very inconsistent.  Do you need to
have batteries in the CM15 for delays to
work?

Thansk again.
Logged

martin

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 125
Re: Flags and Else Statements Don't Work
« Reply #6 on: April 18, 2005, 04:21:42 PM »

Ant,

Let me figure out what you’re trying to do:

On your initial macro step, it checks if a
flag is set or cleared (only condition?).
If flag is set then Run Macro. You’re right,
it should not proceed to the Else condition
as this would be a true statement. Remember
that the flags are set in the CM15A hardware
only so you cannot run your macro from the
AHP UI (should be fixed in the next release
though).
I believe the batteries are used only to
keep time on the internal clock when CM15A
disconnected / power outage.
Logged

Ant

  • Guest
Re: Flags and Else Statements Don't Work
« Reply #7 on: April 18, 2005, 04:31:18 PM »

Hi Martin,

That's all I'm trying to do.  I even set a
flag in the ELSE condition and check the
status just to prove that AHP is addressing
both conditions.

I thought that the batteries were just
required to keep internal clock time and
are essential (in the event of a power
outage) for the running of timed events.
However, the operation of regular delays
seems very sporadic.

I have one macros which just dims one
light, waits 2 seconds and then dims
another.  When AHP is connected to the PC
this works, but standalone it does not.  If
I remove the delay, it works fine.

I am using the delay in the smartmacro to
start a 1 minute countdown and at the end
of it clear a flag.  If a signal is
received prior to the end of the countdown,
then another action is triggered based on
the uncleared flag status.

Again, this works fine when connected to
the PC, but does not work standalone.

???
Logged
 

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