Home AMX User Forum AMX General Discussion

Wait_until ???

I have a Comm problem that I should communicate with a device in a well defined sequence. I started sending one msg after another with setting flags in the function and reading them in the data_event, then calling another function setting another flag and so on.

I suppose that I could use one function with WAIT_UNTIL instead, but was told not to do so. what do I have to consider using WAIT_UNTIL ???

thanks

Comments

  • SensivaSensiva Posts: 211
    Wait_Until

    Wait_Until makes the master waits until a condition come true... but you gotta know that...
    Wait instructions allow delayed execution of one or more program statements.
    When a wait statement is executed, it is added to a stack of currently active wait and the program continues running.
    All variables inside the wait are evaluated at the time the wait is executed, not when it is added to the stack.
    From AMX Programmers BlackBook ;)

    so handling of maths and numericals during this wait will be hard somehow... but it may work, try it and use a watch window to monitor your Vars and see if it is doing well or not....i don't know what exactly you wanna do to tell you how to work arround

    Good Luck
  • DHawthorneDHawthorne Posts: 4,584
    One of the things I use WAIT_UNTIL for is projector commands when the projector has a warmup and cooldown period. I'll make a status variable showing whether the projector is full on, for example, or just warming, and then use the WAIT_UNTIL to hold source and mode change commands until it's full on. I am always, however, very careful that my condition absolutely resolve before using it. I also tend not to use variable inside one at all, only static commands.
  • yuriyuri Posts: 861
    DHawthorne wrote:
    One of the things I use WAIT_UNTIL for is projector commands when the projector has a warmup and cooldown period. I'll make a status variable showing whether the projector is full on, for example, or just warming, and then use the WAIT_UNTIL to hold source and mode change commands until it's full on. I am always, however, very careful that my condition absolutely resolve before using it. I also tend not to use variable inside one at all, only static commands.

    You could do that using a timeline. It's nicer and has more functionality :)
  • DHawthorneDHawthorne Posts: 4,584
    yuri wrote:
    You could do that using a timeline. It's nicer and has more functionality :)

    Actually, I may use a timeline for the actual projector timeout, but it's not practical for the way I am using WAIT_UNTIL. Let me elaborate. Every time a source is changed, I have a segment that was a WAIT_UNTIL(cTV_Status == TV_ON). Inside that block is the code that changes the projector input, aspect ration, and whatever else need to be switched for that source. If it's already on, it fires right away; if not, it will as soon as the warmup is complete. It's just not necessary to create a new timeline for every source the way I am doing it.
Sign In or Register to comment.