Home AMX User Forum AMX Technical Discussion
Options

Double push

I'm writing UI module for touch panels with one page, which controls devices depending on selected room. Button event of panel calls button event of virtual device with channel, corresponding to selected room. I have troubles with feedback, and I think they are caused by one thing: i see in notifications that PUSH event of virtual button called twice:

Line 1 (18:29:14):: Input Status:Pushed [10203:1:1] - Channel 431
Line 2 (18:29:14):: Input Status:Pushed [33104:1:1] - Channel 721
Line 3 (18:29:14):: Input Status:Pushed [33104:1:1] - Channel 721
Line 4 (18:29:14):: Input Status:Released [10203:1:1] - Channel 431
Line 5 (18:29:14):: Input Status:Released [33104:1:1] - Channel 721
Line 6 (18:29:14):: Input Status:Released [33104:1:1] - Channel 721


Piece of code that processes events:


//
SHADES
BUTTON_EVENT[TP, UI_SHADES_BUT]
{ PUSH:
{
LOCAL_VAR INTEGER NUM
NUM=GET_LAST(UI_SHADES_BUT)

DO_PUSH_TIMED(VDV_UI_4, SHADE_AR[SHADEOFROOM[NROOM]][NUM], 1)
}
}

//
FEEDBACK
CHANNEL_EVENT[vdv_ui_4, SHADE_AR[SHADEOFROOM[NROOM]]]
{
ON:
{
LOCAL_VAR INTEGER cBUT
cBUT=GET_LAST(SHADE_AR[SHADEOFROOM[NROOM]])
ON[TP, UI_SHADES_BUT[cBUT]]
}

OFF:
{
LOCAL_VAR INTEGER cBUT
cBUT=GET_LAST(SHADE_AR[SHADEOFROOM[NROOM]])
OFF[TP, UI_SHADES_BUT[cBUT]]
}
}

After room selecting doing Rebuild_event().
Why Push event generates twice?

Comments

  • Options
    champchamp Posts: 261
    I just threw some code into a controller and DO_PUSH definitely causes 2 Input Status:Pushed notifications and I don't know why.
    The good news is that it doesn't cause 2 button events; I added a SEND_STRING 0 to the button event and only one line appears in Diagnostics.
    Maybe it is a bug in Notifications.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    Probably one is the command going out from DO_PUSH, and the other is the actual event. Just an inconsistency in how the firmware reports it to notifications.
  • Options
    depsdeps Posts: 27
    Trouble with feedback was in another unknown thing, just added one IF condition:

    CHANNEL_EVENT[vdv_ui_4, SHADE_AR[SHADEOFROOM[NROOM]]]
    {
    ON:
    {
    LOCAL_VAR INTEGER cBUT
    cBUT=GET_LAST(SHADE_AR[SHADEOFROOM[NROOM]])
    WAIT 1
    IF([VDV_UI_4, SHADE_AR[SHADEOFROOM[NROOM]][cBUT])
    ON[TP, UI_SHADES_BUT[cBUT]]
    }

    OFF:
    {
    LOCAL_VAR INTEGER cBUT
    cBUT=GET_LAST(SHADE_AR[SHADEOFROOM[NROOM]])
    WAIT 1
    IF(![VDV_UI_4, SHADE_AR[SHADEOFROOM[NROOM]][cBUT])
    OFF[TP, UI_SHADES_BUT[cBUT]]
    }
    }
Sign In or Register to comment.