Home AMX User Forum AMX General Discussion

DEVCHAN and GET_LAST

I'm familiar with using DEVCHAN arrays, and I can use GET_LAST with said array when there's only one touchpanel. If there's more than one TP, I run into problems with the value the GET_LAST gives me (I want it to be the same for each different panel).

DEVCHAN TP_BUTTON [] =
{
{TP1,10},{TP1,11},{TP1,12},
{TP2,15},{TP2,16},{TP2,17}
}

GET_LAST would return a 4 when TP2,15 is pushed, but in my code it would be much better to see a 1, like when TP1,10 is pushed. Do I need a separate DEVCHAN array per touchpanel? If I put all the panels in a DEV array first, I can't put that DEV in a DEVCHAN array, which would seem the best solution.

Make any sense?

Jeff Lockyear
Synergy Home Systems, Toronto

Comments

  • Try this.

    Jeff,

    Set up an array of devices and a separate array of channels.
    Define_Device
    dvTP1 = 10001:1:0
    dvTP2 = 10002:1:0
    
    Define_Constant
    INTEGER nButtons[] =
    {
      10,
      11,
      12
    }
    
    Define_Variable
    DEV dv_TP[] =
    {
      dvTP1
      dvTP2
    }
    Volatile nCurrent_TP
    Volatile nCurrent_Button
    
    Define_Event
    Button_Event[dv_TP,nButtons]
    {
      Push:
      {
        nCurrent_TP = Get_Last(dv_TP)
        nCurrent_Button = Get_Last(nButtons)
      }
    }
    
  • <Click!> Looking at that makes a lot of sense. I'll give it a shot. Thanks a ton.

    Jeff
Sign In or Register to comment.