Home AMX User Forum NetLinx Studio

Having an awful time with level connections

NI-3100 with latest firmware, NI-700 with latest firmware. NI-700 has system Number 2 and URL of NI-3100 in URL list, and they are connected and talking Master-to-master OK.

I'm controlling 3 lighting boards. Here's the relevant code:
DEFINE_DEVICE
// AXLink Bus Devices
dvlights_a    	= 17:1:2	// Radia      Aud Light Controller Panel A
dvlights_b    	= 18:1:2	// Radia      Aud Light Controller Panel B
dvlights_c    	= 20:1:2	// Radia      Aud Light Controller Panel C

vdvlights_a	= 33011:1:0	// Virtual for light board a
vdvlights_b	= 33012:1:0	// Virtual for light board b
vdvlights_c	= 33013:1:0	// Virtual for light board c

DEFINE_VARIABLE
define_connect_level
// Lighting levels
(vdvlights_a,1,dvlights_a,1)
(vdvlights_a,2,dvlights_a,2)
(vdvlights_a,3,dvlights_a,3)
(vdvlights_a,4,dvlights_a,4)
(vdvlights_a,5,dvlights_a,5)
(vdvlights_a,6,dvlights_a,6)
(vdvlights_b,1,dvlights_b,1)
(vdvlights_b,2,dvlights_b,2)
(vdvlights_b,3,dvlights_b,3)
(vdvlights_b,4,dvlights_b,4)
(vdvlights_b,5,dvlights_b,5)
(vdvlights_b,6,dvlights_b,6)
(vdvlights_c,1,dvlights_c,1)
(vdvlights_c,2,dvlights_c,2)
(vdvlights_c,3,dvlights_c,3)
(vdvlights_c,4,dvlights_c,4)

DEFINE_START
create_level vdvlights_a,1,lights[1].chan[1].raw
create_level vdvlights_a,2,lights[1].chan[2].raw
create_level vdvlights_a,3,lights[1].chan[3].raw
create_level vdvlights_a,4,lights[1].chan[4].raw
create_level vdvlights_a,5,lights[1].chan[5].raw

create_level vdvlights_b,1,lights[2].chan[1].raw
create_level vdvlights_b,2,lights[2].chan[2].raw
create_level vdvlights_b,3,lights[2].chan[3].raw
create_level vdvlights_b,4,lights[2].chan[4].raw
create_level vdvlights_b,5,lights[2].chan[5].raw
create_level vdvlights_b,6,lights[2].chan[6].raw

create_level vdvlights_c,1,lights[3].chan[1].raw
create_level vdvlights_c,2,lights[3].chan[2].raw
create_level vdvlights_c,3,lights[3].chan[3].raw
create_level vdvlights_c,4,lights[3].chan[4].raw

DEFINE_EVENT
level_event[dvlights_a,4] { 
    call 'debug' ("'Light Level Feedback:',itoa(1),'/',itoa(4),' Val:',itoa(level.value),' for ',lights[1].chan[4].name")
    call 'lightfeedback' (1,4) //updates gangs
}
level_event[dvlights_a,5] { 
    call 'debug' ("'Light Level Feedback:',itoa(1),'/',itoa(5),' Val:',itoa(level.value),' for ',lights[1].chan[5].name")
//    call 'lightfeedback' (1,5) //NO FEEDBACK NEEDED
}

So then when I'm watching Notifications, I *sometimes* see this (works right):
Line    214 :: Level Value From [17:1:2] - Level 4  Value= 206 - 23:49:57
Line    215 :: Level Value To [33011:1:1] - Level 4  Value= 206 - 23:49:57

...And sometimes I only see this (virtual never picks up level change):
Line    114 :: Level Value From [17:1:2] - Level 4  Value= 178 - 23:28:37

Some of the levels appear to trap level changes and feed them to the variable all the time. But some of them don't seem to trap very well. Debug shows the value in the variable has not changed, even though the variable and the level are tied together and it gets an updated value *sometimes*.

If I explicitly put the variable assignment in the level event
level_event[dvlights_a,4] { 
    call 'debug' ("'Light Level Feedback:',itoa(1),'/',itoa(4),' Val:',itoa(level.value),' for ',lights[1].chan[4].name")
    lights[1].chan[4].raw = level.value
    call 'lightfeedback' (1,4) //updates gangs
}
...It always explicitly works.

Any ideas what's going on? this is driving me nuts!

Comments

  • DHawthorneDHawthorne Posts: 4,584
    It's more than likely a glitch in the connect_level function. Usually when I run into something like that, I cut my losses and assign it explicitly. My guess is the level event isn't consistently passing to the virtual. I have never seen an issue with CREATE_LEVEL, so I think it is not in there.
  • Thank you so much for the sanity check! Going explicit is exactly what I did, and except for some kludgy-looking code, I'm very happy with the results.
  • ericmedleyericmedley Posts: 4,177
    Thank you so much for the sanity check! Going explicit is exactly what I did, and except for some kludgy-looking code, I'm very happy with the results.

    Sometimes Kludgy code is an artform worthy of awe and praise.
  • ericmedley wrote: »
    Sometimes Kludgy code is an artform worthy of awe and praise.

    Nice quote - can I have it for my sig?
Sign In or Register to comment.