Home AMX User Forum NetLinx Studio

COMBINE_DEVICE and selective use

Helo,

I'm new here and in my project I use 4 panels, I connect them with vdvTP and function COMBINE_DEVICE. sometimes i need selective one panel, which I want to use (ex.dvTP2) what can i do to work only this panel when i use function BUTTON_EVENT. i don't want to use function UNCONBINE_DEVICE.
sorry for ma english, i'm beginer :)

Yendrek.

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    Hi Yendrek,

    One way to accomplish what you want is to make an array of touch panels and use GET_LAST instead of the COMBINE_DEVICE routine. For example:
    DEFINE_DEVICE
    
    dvTP1	= 10001:1:0
    dvTP2	= 10002:1:0
    dvTP3	= 10003:1:0
    dvTP4	= 10004:1:0
    
    DEFINE_VARIABLE
    
    DEV dvTPs[] = {dvTP1,dvTP2,dvTP3,dvTP4}
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTPs,1] {
    
       PUSH: { 
          INTEGER index
          index = GET_LAST(dvTPs)
          //If the user pushed button 1 on dvTP2 then index = 2
       }
    }
    
  • Hi Joe,
    Thank you for your reply. I know the solution you suggest, but my problem is
    that I use about 600 functions of BUTTON EVENT for all the panels
    alltogether and the convenient way is to use the function vdvTP (as below)

    Code:
    DEFINE_DEVICE

    dvTP1 = 10001:1:0
    dvTP2 = 10002:1:0
    dvTP3 = 10003:1:0
    dvTP4 = 10004:1:0
    vdvTP = 33001:1:0

    DEFINE_COMBINE (vdvTP,dvTP1,dvTP2,dvTP3,dvTP4)

    DEFINE_VARIABLE

    DEV dvTPs[] = {dvTP1,dvTP2,dvTP3,dvTP4}

    DEFINE_EVENT

    BUTTON_EVENT[vdvTP,1]
    {
    PUSH:{....}
    }
    ..
    ...
    ....
    BUTTON_EVENT[vdvTP,600]
    {
    PUSH:{....}
    }

    BUTTON_EVENT[dvTPs,700] {

    PUSH: {
    INTEGER index
    index = GET_LAST(dvTPs)
    //If the user pushed button 1 on dvTP2 then index = 2
    }
    }
    and then the solution, you gave me, doesn't make it possible to call
    selectively only one concrete panel, for example dvTP2.

    Is there any solution to achieve a selective call together with the function
    COMBINE_DEVICE?

    Best regards,
    Yendrek
  • Yendrek wrote:
    Hi Joe,
    Thank you for your reply. I know the solution you suggest, but my problem is
    that I use about 600 functions of BUTTON EVENT for all the panels
    alltogether and the convenient way is to use the function vdvTP (as below)

    Code:
    DEFINE_DEVICE

    dvTP1 = 10001:1:0
    dvTP2 = 10002:1:0
    dvTP3 = 10003:1:0
    dvTP4 = 10004:1:0
    vdvTP = 33001:1:0

    DEFINE_COMBINE (vdvTP,dvTP1,dvTP2,dvTP3,dvTP4)

    DEFINE_VARIABLE

    DEV dvTPs[] = {dvTP1,dvTP2,dvTP3,dvTP4}

    DEFINE_EVENT

    BUTTON_EVENT[vdvTP,1]
    {
    PUSH:{....}
    }
    ..
    ...
    ....
    BUTTON_EVENT[vdvTP,600]
    {
    PUSH:{....}
    }

    BUTTON_EVENT[dvTPs,700] {

    PUSH: {
    INTEGER index
    index = GET_LAST(dvTPs)
    //If the user pushed button 1 on dvTP2 then index = 2
    }
    }
    and then the solution, you gave me, doesn't make it possible to call
    selectively only one concrete panel, for example dvTP2.

    Is there any solution to achieve a selective call together with the function
    COMBINE_DEVICE?

    Best regards,
    Yendrek

    What about this one:
    BUTTON_EVENT[dvTPs,4]
    {
    PUSH:
    {
    IF(BUTTON.INPUT.DEVICE = dvTP2)
    {
    // if PUSH was from Panel dvTP2 
    }
    }
    }
    

    IF you have done a combine (DEFINE_COMBINE for static or COMBINE_DEVICES for dynamic combining) the master only will see the 1st device in the Combine list. The only exception is the ONLINE and OFFLINE, which will also work for every device in a combine list.
  • Joe HebertJoe Hebert Posts: 2,159
    Yendrek wrote:
    the solution, you gave me, doesn't make it possible to call selectively only one concrete panel, for example dvTP2.
    To turn on channel 10 for only dvTP2 you can do one of the following:

    ON[dvTP2,10] //direct
    ON[dvTPs[2],10] //indexing through the TP array

    Or as Marc pointed out you can use BUTTON.INPUT.DEVICE - assuming dvTP2 fired of the EVENT:
    BUTTON_EVENT[dvTPs,1] {
       PUSH: {
          ON[BUTTON.INPUT.DEVICE,10]
       }
    }
    

    I use GET_LAST(dvTPs) when I want to know the actual index into the array. For example let?s say I want to keep track of what each TP is controlling at the present time and store it in a structure. I might use the following scenario:
    DEFINE_CONSTANT
    
    INTEGER nMaxTPs = 4
    INTEGER nZoneButtons[] = {11,12,13,14,15}  //zones 1-5
    
    DEFINE_DEVICE
    
    dvTP1	= 10001:1:0
    dvTP2	= 10002:1:0
    dvTP3	= 10003:1:0
    dvTP4	= 10004:1:0
    
    DEFINE_TYPE
    
    STRUCT	sTPInfo {
       
       INTEGER nCurrentZone
       INTEGER nCurrentClimate
       INTEGER nCurrentLight
    
    }
    
    DEFINE_VARIABLE
    
    DEV dvTPs[] = {dvTP1,dvTP2,dvTP3,dvTP4}
    
    sTPInfo	sTPInfos[nMaxTPs]
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTPs,nZoneButtons] {
    
       PUSH: {
                
          //this will track the current zone (1-5) for the TP
          sTPInfos[GET_LAST(dvTPs)].nCurrentZone = GET_LAST(nZoneButtons)
          
       }
    }
    
    Yendrek wrote:
    Is there any solution to achieve a selective call together with the
    functionCOMBINE_DEVICE?
    Nope, if the devices are combined then any action to either vdvTP or any of the dvTPx will act on all the devices in the combine, except as Marc pointed out, the ONLINE and OFFLINE events.
  • By using this "DEV dvTP[]={dvTPW,dvWTP}" you can control all each independently.
    ie:
    Define_device:
    dvTPW = 128:1:0 (* AMX AXD-CV10 DEVICE #1 *)
    dvTPW1 = 129:1:0 (* AMX AXD-CV10 DEVICE #2 *)
    dvWTP = 226:1:0 (* HTML PANEL DEVICE #1 *)
    dvWTP1 = 227:1:0 (* HTML PANEL DEVICE #2 *)
    Define_variable:
    DEV dvTP[]={dvTPW,dvWTP}
    DEV dvTP1[]={dvTPW1,dvWTP1}
Sign In or Register to comment.