Home AMX User Forum NetLinx Studio

Timeline Always Run for One Second

This codes exists within a module. The timeline event always happens after one second regardless of the value of lTL1_10Sec
VOLATILE LONG lTL1_10Sec[1]={10000}


TIMELINE_CREATE (1,lTL1_10Sec,1,TIMELINE_RELATIVE,TIMELINE_ONCE)

TIMELINE_EVENT [1]

Hmmmm?

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    Hmmm is right. That?s a 10 second timeline you got there. Is this your module? Might there be a duplicate Timeline ID in the there? You didn?t post much code and I don?t know how you know it?s going off once a second so I can?t be of much more help other than post code that verifies your snippet fires once every ten seconds.
    DEFINE_DEVICE
    
    dvTP = 10001:1:0
    
    DEFINE_VARIABLE
    
    VOLATILE LONG lTL1_10Sec[1]={10000}
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP,1] {
    
       PUSH: {
       
          TIMELINE_CREATE (1,lTL1_10Sec,1,TIMELINE_RELATIVE,TIMELINE_ONCE)
          SEND_STRING 0,'Timeline Created'
       }
    }
    
    TIMELINE_EVENT [1] {
    
       SEND_STRING 0,'Timeline Triggered'
    }
    

    And the output when button 1 is pushed.
    Line      1 :: Timeline Created - 22:28:30
    Line      2 :: Timeline Triggered - 22:28:40
    

    This codes exists within a module. The timeline event always happens after one second regardless of the value of lTL1_10Sec
    VOLATILE LONG lTL1_10Sec[1]={10000}
    
    
    TIMELINE_CREATE (1,lTL1_10Sec,1,TIMELINE_RELATIVE,TIMELINE_ONCE)
    
    TIMELINE_EVENT [1]
    

    Hmmmm?
  • ericmedleyericmedley Posts: 4,177
    This codes exists within a module. The timeline event always happens after one second regardless of the value of lTL1_10Sec
    VOLATILE LONG lTL1_10Sec[1]={10000}
    
    
    TIMELINE_CREATE (1,lTL1_10Sec,1,TIMELINE_RELATIVE,TIMELINE_ONCE)
    
    TIMELINE_EVENT [1]
    

    Hmmmm?

    Just for grins and giggles, perhaps you can go ahead and make the variable VOLATILE LONG lTL1_10Sec[1]={10000} and array. and see how that behaves.

    so,

    VOLATILE LONG lTL1_10Sec[2]

    lTL1_10Sec[1]=1
    lTL1_10Sec[2]=10000

    Then just don't do anything on the first timeline event.

    See how that behaves...
  • Joe HebertJoe Hebert Posts: 2,159
    ericmedley wrote: »
    Just for grins and giggles, perhaps you can go ahead and make the variable VOLATILE LONG lTL1_10Sec[1]={10000} and array. and see how that behaves.
    It already is an array, the square brackets indicate that. It?s an array of 1 but none the less an array. I use single element arrays all the time for timelines. Although I would do it like this instead - VOLATILE LONG lTL1_10Sec[]={10000} and let the compiler figure out the size. Either way is perfectly legal.
  • TurnipTruckTurnipTruck Posts: 1,485
    Complete code related to the timline in question:
    VOLATILE LONG lTL1_10Sec[1]={10000}
    
    BUTTON_EVENT [dUIs,cnChannelProgram]
    {
    PUSH:
        {
        nUI=GET_LAST(dUIs)
        nBut=GET_LAST(cnChannelProgram)
        IF (NOT(TIMELINE_ACTIVE(nUI)))
            TIMELINE_CREATE (nUI,lTL1_10Sec,1,TIMELINE_RELATIVE,TIMELINE_ONCE)
        ELSE
            TIMELINE_SET (nUI,1)
        SWITCH (nBut)
             {
             CASE 1:
                        {
    	    OFF[dUIs[nUI],2]
    	    ON[dUIs[nUI],1]
    	    nChannelProgram[nUI]=1
    	    }
    	CASE 2:
    	    {
    	    OFF[dUIs[nUI],1]
    	    ON[dUIs[nUI],2]
    	    nChannelProgram[nUI]=2
    	    }
    	}
        }
    }
    
    TIMELINE_EVENT [1]
    TIMELINE_EVENT [2]
    TIMELINE_EVENT [3]
    TIMELINE_EVENT [4]
    TIMELINE_EVENT [5]
    TIMELINE_EVENT [6]
    TIMELINE_EVENT [7]
    TIMELINE_EVENT [8]
    TIMELINE_EVENT [9]
    TIMELINE_EVENT [10]
    {
    nChannelProgram[TIMELINE.ID]=0
    OFF[dUIs[TIMELINE.ID],cnChannelProgram]
    }
    
    

    Commenting out the variable definition results in a compiler error. Thus I know that there are no confused variables for the timeline time values.
  • Joe HebertJoe Hebert Posts: 2,159
    Help me help you....
    Complete code related to the timline in question:
    Is it possible to post something that can be compiled? I filled in the blanks as best I could and I still don't see anything wrong with the timeline creation. It fires 10 seconds after the last push. What is your indication that it fires after 1 second no matter what?

    If you don't want to post more code then I suggest putting in a SEND_STRING 0 whenever you start the timeline (or set the timeline timer back to 1) and do a SEND_STRING 0 when the timeline fires.

    I wish I could be of more help but I don't have enough to go on.
  • TurnipTruckTurnipTruck Posts: 1,485
    Joe Hebert wrote: »
    I wish I could be of more help but I don't have enough to go on.

    Sorry about that. I didn't realize that you were trying to compile my code. It is from a long-winded module for a specific digital tv tuner. I'll try to post more later.
  • alexanboalexanbo Posts: 282
    Is nUI declared as an integer?

    TimelineID's need to be Longs so maybe that's what is screwing things up.
  • AMXJeffAMXJeff Posts: 450
    I tested the code as written...Timeline triggers after tens seconds...So it works for me...
    DEFINE_VARIABLE
    
    VOLATILE LONG lTL1_10Sec[1]={10000}
    
    DEFINE_START
    
    wait 100
    {
    	TIMELINE_CREATE (1,lTL1_10Sec,1,TIMELINE_RELATIVE,TIMELINE_once)
    	send_string 0,'test, start'
    }
    
    DEFINE_EVENT
    
    TIMELINE_EVENT [1]
    {
    	send_string 0,'test, hit'
    }
    
    (0000019651) test, start
    (0000029661) test, hit
    
  • DHawthorneDHawthorne Posts: 4,584
    Just for test purposes, comment out the stacked TIMELINE_EVENTs so only one can possibly trigger. I strongly suspect they are interfering with each other. It's been my experience that constructions that work with regular devchans don't always do as expected in a timeline, most likely due to something under the hood in the handler functions.
  • TurnipTruckTurnipTruck Posts: 1,485
    Problem is solved. I had another timeline being created elsewhere in the module with one of the numbers in the stack of ten timeline events. This module was the combination of what used to be a seperate comm and UI. I overlooked it in the marraige of the the two modules.

    BTW, I use that stacking of timelines all the time and have never yet had a probelm related to it. Works well for making waits related to UIs that can be tracked and managed seperately.

    Thanks to all who had a look at the module for me!
Sign In or Register to comment.