Retrig Timer

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Memphix, Dec 18, 2006.

  1. Memphix

    Memphix

    Joined:
    Aug 31, 2006
    Messages:
    248
    Likes Received:
    1
    Location:
    Australia
    I need to imitate a retrig timer in logic... am I missing that command or do I need to write logic to imitate it? :confused:
     
    Memphix, Dec 18, 2006
    #1
  2. Memphix

    Memphix

    Joined:
    Aug 31, 2006
    Messages:
    248
    Likes Received:
    1
    Location:
    Australia
    This is the logic I'm using:

    once (GetLightingState("XXX") = ON) then
    begin
    TimerSet(1, 0);
    TimerStart(1);
    SetLightingLevel("Light", 100%, "0s");
    end;

    once (TimerTime(1)="0:01:00") then
    begin
    SetLightingLevel("Light", 0%, "0s");
    end;

    ------------------------------------------
    XXX: is the trigger (not an adult shop)
    Light: is the light turned on
     
    Memphix, Dec 18, 2006
    #2
  3. Memphix

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    A C-Bus component can be a toggle timer or a re-triggerable timer. What are you wanting to do ?
     
    Darren, Dec 18, 2006
    #3
  4. Memphix

    Memphix

    Joined:
    Aug 31, 2006
    Messages:
    248
    Likes Received:
    1
    Location:
    Australia
    The touch screen logic is triggered from the AUX input unit which needs to turn lights on for 1 minute.

    Thought there might of been a simple command in the logic.

    There are two inputs, which led me to using this code:

    once (GetLightingState("Input1") = ON) then
    begin
    TimerStop(1);
    SetLightingLevel("Light", 100%, "0s");
    end;

    once (GetLightingState("Input2") = ON) then
    begin
    TimerStop(1);
    SetLightingLevel("Light", 100%, "0s");
    end;

    once (GetLightingState("Input1") = OFF) and
    (GetLightingState("Input2") = OFF) then
    begin
    TimerStart(1);
    end;

    once (TimerTime(1)="0:0:10") then
    begin
    SetLightingLevel("Light", 0%, "0s");
    TimerStop(1);
    end;
     
    Memphix, Dec 19, 2006
    #4
  5. Memphix

    Phil.H

    Joined:
    Jul 29, 2004
    Messages:
    466
    Likes Received:
    0
    Location:
    Sydney
    You guys are getting spoilt ;)

    PS. You could reduce your code by having your two inputs covered in an "or" statement that would reduce all that code, then again I wonder why Darren hasn't come up with a simple timer utility. And to think I was going to vote for Darren for Prime Minister at one stage... ;)
     
    Last edited by a moderator: Dec 19, 2006
    Phil.H, Dec 19, 2006
    #5
  6. Memphix

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    It looks from the code like you are implementing something equivalent to a "corridor linking" function where if any of the controlling lights go on, then the "corridor" light goes on. When they all go off, there is a delay before the corridor light goes off.

    If I have understood your requirements properly, you can use the PulseCBusLevel command to do what you want :

    Code:
    once (GetLightingState("Input1") = ON) or (GetLightingState("Input2") = ON) then
    begin
      SetLightingLevel("Light", 100%, "0s");
    end;
    
    once (GetLightingState("Input1") = OFF) and (GetLightingState("Input2") = OFF) then
    begin
      PulseCBusLevel("Local", "Lighting", "Light", 100%, "0s", "0:00:10", 0%);
    end;
    
    Do I get your vote again now ? :D
     
    Darren, Dec 19, 2006
    #6
  7. Memphix

    Phil.H

    Joined:
    Jul 29, 2004
    Messages:
    466
    Likes Received:
    0
    Location:
    Sydney
    No,,, because politicians are self interested dirtbags. You gave the world Once, stay true timer, and logic wizard arranged the way a couple clowns from NSW asked for (beginners in mind). I think you would be wasted as Prime Minister. :D
     
    Phil.H, Dec 20, 2006
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.