Home AMX User Forum NetLinx Studio

DEV array with simple feedback.

Hi all,
I am looking at combining devices useing the DEV method.
My simple program below does not update the feedback on one of the panels. does any one see a problem.

Regards
Craig

PROGRAM_NAME='test'

DEFINE_DEVICE
dvWifiPanel1 = 10001:1:6 // Wireless Panel 1 (MVP-8400) (Office)
dvWifiPanel2 = 10002:1:6 // Wireless Panel 2 (MVP-8400) (VC Room)

bOfficeLightsFull = 36
bOfficeLightsPresentation = 35
bOfficeLightsConference = 34
bOfficeLightsOff = 33

DEFINE_VARIABLE
DEV vdvWifiPanels[] = {dvWifiPanel1,dvWifiPanel2}

DEFINE_MUTUALLY_EXCLUSIVE
([vdvWifiPanels,bOfficeLightsFull],[vdvWifiPanels,bOfficeLightsConference],[vdvWifiPanels,bOfficeLightsPresentation],[vdvWifiPanels,bOfficeLightsOff])

DEFINE_START
WAIT 450
{
ON[vdvWifiPanels,bOfficeLightsFull]
}

DEFINE_EVENT
BUTTON_EVENT[vdvWifiPanels,bOfficeLightsFull]
{
PUSH:
{
ON[vdvWifiPanels,bOfficeLightsFull]
}
}
BUTTON_EVENT[vdvWifiPanels,bOfficeLightsPresentation]
{
PUSH:
{
ON[vdvWifiPanels,bOfficeLightsPresentation]
}
}
BUTTON_EVENT[vdvWifiPanels,bOfficeLightsConference]
{
PUSH:
{
ON[vdvWifiPanels,bOfficeLightsConference]
}
}
BUTTON_EVENT[vdvWifiPanels,bOfficeLightsOff]
{
PUSH:
{
ON[vdvWifiPanels,bOfficeLightsOff]
}
}

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    This is not legal:
    DEFINE_MUTUALLY_EXCLUSIVE
    ([vdvWifiPanels,bOfficeLightsFull],[vdvWifiPanels,bOfficeLightsConference],[vdvWifiPanels,bOfficeLightsPresentation],[vdvWifiPanels,bOfficeLightsOff])
    

    If you want to go the mutually exclusive route you will need to do something like this instead:
    DEFINE_MUTUALLY_EXCLUSIVE
    ([dvWifiPanel1,bOfficeLightsFull],[dvWifiPanel1,bOfficeLightsConference],[dvWifiPanel1,bOfficeLightsPresentation],[dvWifiPanel1,bOfficeLightsOff])
    ([dvWifiPanel2,bOfficeLightsFull],[dvWifiPanel2,bOfficeLightsConference],[dvWifiPanel2,bOfficeLightsPresentation],[dvWifiPanel2,bOfficeLightsOff])
    


    And this:
    DEFINE_START
    
    WAIT 450
    {
    ON[vdvWifiPanels,bOfficeLightsFull]
    }
    


    Is better off in the DATA_EVENT:
    DEFINE_EVENT
    
    DATA_EVENT[vdvWifiPanels] {
    
       ONLINE: {
          ON[DATA.DEVICE,bOfficeLightsFull]
       }
    }
    

    HTH
  • And get rid of the DEFINE_MUTUALLY_EXCLUSIVE!!!
    DEFINE_VARIABLE
    
    PERSISTENT CHAR cStateLights
    
    
    DEFINE_EVENT
    
    BUTTON_EVENT[vdvWifiPanels,bOfficeLightsFull]
    BUTTON_EVENT[vdvWifiPanels,bOfficeLightsPresentation]
    BUTTON_EVENT[vdvWifiPanels,bOfficeLightsConference]
    BUTTON_EVENT[vdvWifiPanels,bOfficeLightsOff]
    PUSH:
    {
        TO[BUTTON.INPUT]
        SWITCH (BUTTON.INPUT.CHANNEL)
        {
            CASE bOfficeLightsFull:         cStateLights = 1
            CASE bOfficeLightsPresentation: cStateLights = 2
            CASE bOfficeLightsConference:   cStateLights = 3
            CASE bOfficeLightsOff:          cStateLights = 0
        }
    }
    
    
    DEFINE_PROGRAM
    
    [vdvWifiPanels,bOfficeLightsFull] =         ( cStateLights = 1)
    [vdvWifiPanels,bOfficeLightsPresentation] = ( cStateLights = 2)
    [vdvWifiPanels,bOfficeLightsConference] =   ( cStateLights = 3)
    [vdvWifiPanels,bOfficeLightsFull] =         ( cStateLights = 0)
    
    
  • jjamesjjames Posts: 2,908
    icraigie wrote:
    And get rid of the DEFINE_MUTUALLY_EXCLUSIVE!!!
    I could not agree more. Putting devices in a DEV array is actually much easier to deal with. I think I tried to use mutually exclusive once, and was shown on here that DEV arrays are the way to go. It gives you the flexibility to control all of the devices at once, or individually. They're not only helpful with touch panels, you can use them on IR devices & RS-232 devices as well. You can do stuff like this:

    Power off all satellite boxes:
    SEND_COMMAND dv_SAT,"'SP',28"
    

    Or just power off a couple of them:
    SEND_COMMAND dv_SAT[1],"'SP',28"
    SEND_COMMAND dv_SAT[2],"'SP',28"
    

    You send send their settings too under one DATA_EVENT:
    DATA_EVENT[dv_SAT]
    {
      ONLINE:
      {
       SEND_COMMAND DATA.DEVICE, "'CTON', 2"
       SEND_COMMAND DATA.DEVICE, "'CTOF', 3"
      }
    }
    

    If you put your panels in a loop, you can have them updated individually or as icragie has done, update them all at once.
  • cmatkincmatkin Posts: 86
    Thank you to all.
    I understand now.

    Regards
    Craig
Sign In or Register to comment.