Multiple instances of same timeline ID?
 Avargas                
                
                    Posts: 57
Avargas                
                
                    Posts: 57                
            
                    Hi all,
In our company we have a module template that we use when we want to create a module for a new device. We used to have the button feedback in the define_program, so in the last few months we replaced it for a timeline_event.
So now, all our modules have inside a timeline with the same ID (always 1), so we can have in a single project 4 or 5 modules made by our own running timelines with the same ID.
Is that a problem? I've just read in a P2 Evaluation Sheet that it is considered a bad practice, why? do the timeline events ID have a global scope and it doesn't matter if they are inside a module? I've never seen a problem or any strange behaviour since we program that way, so I don't understand that statement from the exam reviewer (and I feel bad because I tell all my students to do it in that way:( ) .
What do you think?
                In our company we have a module template that we use when we want to create a module for a new device. We used to have the button feedback in the define_program, so in the last few months we replaced it for a timeline_event.
So now, all our modules have inside a timeline with the same ID (always 1), so we can have in a single project 4 or 5 modules made by our own running timelines with the same ID.
Is that a problem? I've just read in a P2 Evaluation Sheet that it is considered a bad practice, why? do the timeline events ID have a global scope and it doesn't matter if they are inside a module? I've never seen a problem or any strange behaviour since we program that way, so I don't understand that statement from the exam reviewer (and I feel bad because I tell all my students to do it in that way:( ) .
What do you think?
0          
            
Comments
I do know that constants and variables live only in the module. You 'can' leave the source code in and wathc them in debug but they don't work outside the module.
I will say that I came up with my own scheme to keep my timelines unique even inside modules but this doesn't cover AMX created modules where I have no idea what's going on.
I suppose one could test this by creating a timeline in a module, then creating a separtate timeline event of the same ID outside it and watcching it for activity. Even better yet, you could run a TIMELINE_ACTIVE(my_Moudle_Timeline__ID) outside the module during its running to see if what it kicks back.
PROGRAM_NAME='proc_01' DEFINE_DEVICE dv_device_01 = 5001:01:01 vdv_device_01 = 33001:01:01 DEFINE_CONSTANT long My_Outside_TL=11; DEFINE_MODULE 'timeline_module' module_01(vdv_device_01,dv_device_01) DEFINE_EVENT timeline_event[My_Outside_TL]{ send_string 0,'Timeline Outside Fired' }and inside module
MODULE_NAME='timeline_module' ( dev vdv_myDevice, dev dv_device) DEFINE_CONSTANT long My_iNside_TL=11; DEFINE_VARIABLE volatile long My_iNside_TL_times[]={1000} define_event data_event[vdv_myDevice]{ online:{ wait 200{ timeline_create(My_iNside_TL, My_iNside_TL_times, length_array(My_iNside_TL_times), timeline_absolute, timeline_repeat ) send_string 0,'timeline has started.' } // wait 200 } } timeline_event[My_iNside_TL]{ send_string 0,'Timeline Inside Fired' }result in terminal:
Don't get me wrong - I understand how it works and it doesn't confuse me. It's just one of those things where the rules don't seem to me to be followed consistently. In my mind an event is a "thing that happened" and it should traverse the scope of the system. Other events do.
The other little one that's always not quite followed what my pea brain senses as the logic is how button/channel feedback and button pushes are not the same thing and one doesn't cause the other. but levels do if the level feedback being sent is an active fader. sending a level (which is supposed to be feedback) to an active fader produces an incoming level event.
There are lots of these kinds of things in netlinx.
I also tested it and it works perfectly with all functions (pause, restart, kill, etc.)
Here the code:
OUTSIDE:
PROGRAM_NAME='Main' DEFINE_DEVICE vdvTimelines = 33001:1:0 DEFINE_CONSTANT volatile long lTimelineID = 1 DEFINE_VARIABLE volatile long lTimes[1] = {200} volatile integer anTimelineOptions[] = {11, // Create 12, // Pause 13, // Restart 14} // Kill DEFINE_START define_module 'TimelineModule' TLModule(vdvTimelines) DEFINE_EVENT channel_event[vdvTimelines,anTimelineOptions] { on: { stack_var integer nOption nOption = get_last(anTimelineOptions) switch(nOption) { case 1: { send_string 0,'OUTSIDE TL: We create the timeline' timeline_create(lTimelineID,lTimes,1,timeline_relative,timeline_repeat) } case 2: { send_string 0,'OUTSIDE TL: We pause the timeline' timeline_pause(lTimelineID) } case 3: { send_string 0,'OUTSIDE TL: We pause the timeline' timeline_restart(lTimelineID) } case 4: { send_string 0,'OUTSIDE TL: We kill the timeline' timeline_kill(lTimelineID) } } } } timeline_event[lTimelineID] { send_string 0,'OUTSIDE: enters into the timeline' }INSIDE:
MODULE_NAME='TimelineModule' (dev vdvTimelines) DEFINE_CONSTANT volatile long lTimelineID = 1 DEFINE_VARIABLE volatile long lTimes[] = {200} volatile integer anTimelineOptions[] = {21, // Create 22, // Pause 23, // Restart 24} // Kill DEFINE_EVENT channel_event[vdvTimelines,anTimelineOptions] { on: { stack_var integer nOption nOption = get_last(anTimelineOptions) switch(nOption) { case 1: { send_string 0,'INSIDE TL: We create the timeline' timeline_create(lTimelineID,lTimes,1,timeline_relative,timeline_repeat) } case 2: { send_string 0,'INSIDE TL: We pause the timeline' timeline_pause(lTimelineID) } case 3: { send_string 0,'INSIDE TL: We pause the timeline' timeline_restart(lTimelineID) } case 4: { send_string 0,'INSIDE TL: We kill the timeline' timeline_kill(lTimelineID) } } } } timeline_event[lTimelineID] { send_string 0,'INSIDE: enters into the timeline' }