Home AMX User Forum AMX General Discussion

Touch Panel coming back online problem

Hi all,

Wondering if anyone can advise me on a problem I am encountering. Got a setup with one MVP7500 and 2 keypads in an auditorium controlling various stuff and a DMX controller to some light ramps. The TP has some level ramps. Now when the TP goes offline and online again (i.e. if I reset the router or some other network hiccup), the level ramps hit zero and all the DMX lights are cut to 0%

I basically store the current DMX light levels in a persistent array: persistent integer dmx_preset[7][12]
and I set levels in define_program using send_level as follows: send_level dvTP,1,dmx_preset[1][10] //etc.
and use event handlers to perform a ramp up/down when someone touches the ramp on the TP e.g...
LEVEL_EVENT[dvTP,1] // stage ramp
{
dmx_preset[1][10] = level.value // update variables
// send command to light channel
send_string dvLIGHTS,"'F00:',itoa(light_fadetime),'.0',$0D"
send_string dvLIGHTS,"'D010@',itoa(dmx_preset[1][10]),$0D"
send_string dvLIGHTS,"'G',$0D"
}

So my question is, what happens when the TP comes back online? It seems to be triggering a level event for all of the ramps, loading them with zero values and sending a command to the DMX. Or am I missing something in my design..or...???

Thanks all,
Brian

Comments

  • viningvining Posts: 4,368
    The easiest thing to do is add a channel to your bar graph, then in the button event for that channel in the push handler set a global variable to 1 or set a flag channel to on. In the release handler set the var to 0 or if using a flag channel turn off. Then qualify your level event with the var or channel. If the var or channel is not set ( 1 or on) ignore the event.

    You can also tie the levels to a virtual.
  • pdabrowskipdabrowski Posts: 184
    another way is to within the ONLINE event for the touchpanel you can send the levels stored inside the variable

    This will still trigger a level event however as the variable is the same there won't be a sudden change to the values sent to the device.

    It will however become an issue if there is manual change on the device that isn't tracked at the same time inside the variable.
  • a_riot42a_riot42 Posts: 1,624
    You can also simply not update the panel with the 0 level when its offline.
    Paul
  • jjamesjjames Posts: 2,908
    A panel's levels go to zero when a panel goes offline. Maybe checking if it's online would prevent assigning / changing anything:
    define_variable
    volatile integer i_panelOnline[i_max_panels]
    
    define_event
    data_event[dvTP]
    {
      online:{i_panelOnline[1] = 1}
      offline:{i_panelOnline[1] = 0}
    }
    
    level_event[dvTP,1]
    {
      if(i_panelOnline[1]) // Proceed if the device is online
      {
         /* update the lighting & all other fancy stuff */
      }
    }
    

    I agree with pdabrowski that you need to update the level in the ONLINE event, however - you need to know when to assign dmx_preset[1][10]. You obviously don't want to set it when the panel is going offline, so something above should work.

    In the event a panel is taken offline (i.e. dropped WiFi, dropped on concrete, etc.) I would assume that those levels & channels are set to zero after the OFFLINE event occurs. Probably something worth testing.
  • viningvining Posts: 4,368
    If you don't want to track variables or flags you can also try:
    level_event[dvTP,1]
         {
         if(DEVICE_ID(dvTP)) // Proceed if the device exists (is online)
    	  {
    	  /* update the lighting & all other fancy stuff */
    	  }
         }
    
    if the tp is offline 0 is returned from the dev_id function and if it's online the actual device id number is returned. I always use the channel method and have never tried using the online flag or dev_id method that others use. As long as the offline event occurs before levels changes are generated either of these methods should work fine.
  • jjamesjjames Posts: 2,908
    I actually put that initially since that's how I would normally check to see if something was online. However, I started thinking of the cost of having the processor call an additional routine and then evaluating the result as opposed to evaluating an integer (or if you could, a char as we only need on and off.) I'd suspect device_id() is not as costly as itoa(), but it's the same idea; imaging going from 25% to 100%, that internal function will be called 75 times very quickly as opposed to evaluating a char or integer array (however it'll be done.)

    It'd be interesting to throw it through the ringer and see if there's a clear advantage to one or the other by looking at CPU and / or timing.
  • viningvining Posts: 4,368
    I too would prefer to check a boolean variable instead of calling the function but if the level event is tied to tp's bargraph how often will it actual run. For something like this i see no harm, no foul.
  • fongslbfongslb Posts: 30
    Hey thanks everyone for the suggestions, I will make some changes to the code and see how it goes. I will need to find out if the lights cut to 0 when it goes offline, or when it comes back online - that part I am unsure and will have to test.

    Regards,
    Brian
Sign In or Register to comment.