Home AMX User Forum NetLinx Studio
Options

bad situation working with level_event and bargraph, when panel go offline

i use a level_event to control lights, but i have a bad situation working with level_event and bargraph, when panel go offline the level goes to 0 and the the lights turn off, any idea to resolve this?

this is my code:
/**********************************************************/

DEFINE_CALL 'F_LUZ_SALAJUNTAS_PLAFON' (INTEGER nPOTENCIA)
{
SEND_COMMAND dvRADIA_89,"'P1L',ITOA(nPOTENCIA),'T4'"
nLUZ_SALAJUNTAS_PLAFON = nPOTENCIA
}

/**********************************************************/

BUTTON_EVENT[PANELS_ILUMINACION,101]
{
PUSH:
{
IF (!nLUZ_SALAJUNTAS_PLAFON)
{
CALL 'F_LUZ_SALAJUNTAS_PLAFON'(nLNOR) //ENCIENDE LA LUZ
}
ELSE
{
CALL 'F_LUZ_SALAJUNTAS_PLAFON'(nLAPA) //APAGA LA LUZ
}
SEND_LEVEL PANELS_ILUMINACION,1,nLUZ_SALAJUNTAS_PLAFON
}
}

/**************************************************************/

LEVEL_EVENT[PANELS_ILUMINACION,1]
{
CALL 'F_LUZ_SALAJUNTAS_PLAFON' (LEVEL.VALUE) // LEE EL NIVEL DEL TP Y LO ASIGNA A LA LUZ
}

/* grettings & good codes */

Comments

  • Options
    a_riot42a_riot42 Posts: 1,624
    Couldn't you do something in your level event like so?
    LEVEL_EVENT[PANELS_ILUMINACION,1]
    {
        if(isOnline(get_last(PANELS_ILUMINACION)))
            CALL 'F_LUZ_SALAJUNTAS_PLAFON' (LEVEL.VALUE) // LEE EL NIVEL DEL TP Y LO ASIGNA A LA LUZ
    }
    
  • Options
    If you test for panel online state in your level event, it won't eliminate the problem of the panel coming online and its default level being zero, which triggers the level event with a value of zero.

    I typically use a channel on the bargraph as well as a level (or on the up/down ramping buttons if the bargraph is display only). I define a button event for this channel, and have it set a variable to TRUE in the push handler, and false in the release handler. Then test for the variable in the level event. This way level events only get processed when someone is touching the button causing a change, rather than any level change.

    Hope this helps,
    Don
  • Options
    a_riot42a_riot42 Posts: 1,624
    Don DeLong wrote: »
    If you test for panel online state in your level event, it won't eliminate the problem of the panel coming online and its default level being zero, which triggers the level event with a value of zero.

    When the panel comes online, presumably you update the level with its current value so its in sync.
    Paul
  • Options
    ericmedleyericmedley Posts: 4,177
    This is one of those areas where the logic of how it works kinda falls apart. For example the feedback of a button is not confused or tied to the operation if the same button. You can have a button press without any feedback at all. But an active touch fader produces a circular feedback loop. You have to do some additional work to break the loop.

    One method is to make the fader a button as well. So, when you touch the fader to move the volume you can withhold send_level until you let go.

    Method two is as suggested above: abandon using the fader to adjust the level and use it strictly for display. Then use buttons to ramp the level up or down.

    The third is stack two faders on top of each other. The bottom fader is display only. The top fader is transparent but is active. So your top fader adjusts the volume but the bottom one displays the level. You burn twice as many faders this way but it works.
  • Options
    the8thstthe8thst Posts: 470
    My work around is this:
    if(device_id(level.input.device)) {
        // Do Your Light Stuff Here
    }
    
Sign In or Register to comment.