Home AMX User Forum NetLinx Studio

Wait_Until Question

I have a wait_until placed in each of my source functions, but it seems that the wait_until only triggers when the system was previously off, not while it is on:
DEFINE_FUNCTION fcnDVD()
{
	IF (nPower = 0)  //Room Off
	{
		//turn room on, set waits/timelines, etc
		fcnPwrOn()
		
	}
	
	
	WAIT_UNTIL(!TIMELINE_ACTIVE(tl_ProjWarmUp))
	{
		SEND_STRING dvPROJ, "cProjComp,fcnCheckSum(cProjComp)"  //proj component input
		nCurrentSource=1
	}
	
}
My hope here was that the wait_until would work as a sort of flag when the system is already on. Am I just coding this wrong, or do I need a different flag to check other than the active/inactive timeline? I figured the timeline was good because it has the necessary 45 sec. delay aready in it.

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    I'm not sure that there is anything wrong with what you are doing, but personally I would just create a ProjectorReady variable and set it to 1 when the warmup time is done and set it to 0 when powered off. Then you could do a wait_until(ProjectorReady).

    This would also be easier to track in debug for troubleshooting purposes.

    Jeff
  • vegastechvegastech Posts: 369
    Figured it out...Wasn't the previously posted code. It was here in my button event:
    BUTTON_EVENT[dcSources]  //latches source buttons together
    {
    	PUSH:
    	{
    		nCurrentSource = GET_LAST(dcSources)
    		IF (nPower = 0)  //<----------------------------------Sneaky!!!!  
    		{
    			//start the projector polling, send proj pwr, update var text fields
    		SWITCH(GET_LAST(dcSources))
    		{
    			CASE 1: fcnDVD()
    			CASE 2: fcnCamera()
    			CASE 3: fcnSAT()
    			
    		}
    		}
    	}
    }
    
    Switch-Case doesn't exactly work here if the room is already on....Guess that's why I should really proofread my code as I do revisions! :)
Sign In or Register to comment.