Home AMX Design Tools

Button Latching

rmjstsrmjsts Junior MemberPosts: 19
I am fairly new to AMX. But I have experience in other touch panel systems. Is there a way to LATCH a buon to the ON position until the next time it is pushed. I have tried channel tracking and that does not work. Also what is the best way to latch opposing buttons. Example: Audio conferencer MIC ON and MIC OFF, this requires 2 buttons MIC ON and MIC OFF. If I press MIC ON I want it to indicate ON and the MIC OFF to indicate OFF, and when MIC OFF is pressed for the MIC ON to become OFF and the MIC OFF to be ON. I may just use PRIVACY with it staying in the ON position when pressed and OFF when off if that is much simpler. So is there a way to make one button react in a specific manner based on the condition of another button?

Comments

  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    rmjsts wrote: »
    I am fairly new to AMX. But I have experience in other touch panel systems. Is there a way to LATCH a buon to the ON position until the next time it is pushed. I have tried channel tracking and that does not work. Also what is the best way to latch opposing buttons. Example: Audio conferencer MIC ON and MIC OFF, this requires 2 buttons MIC ON and MIC OFF. If I press MIC ON I want it to indicate ON and the MIC OFF to indicate OFF, and when MIC OFF is pressed for the MIC ON to become OFF and the MIC OFF to be ON. I may just use PRIVACY with it staying in the ON position when pressed and OFF when off if that is much simpler. So is there a way to make one button react in a specific manner based on the condition of another button?

    You might find DEFINE_LATCHING and DEFINE_MUTUALLY_EXCLUSIVE in the help files. It should have all the answers you need.

    For example
    DEFINE_MUTUALLY_EXCLUSIVE
    
    ( [dvTP_1,1] .. [dvTP_1,10] )
    
    

    will mean that feedback can only be on for one buttons 1-10 to be on. If 1 was on, and then you turn 3 on, 1 will go off automatically.
  • rmjstsrmjsts Junior Member Posts: 19
    Latching

    OK. I tried the HELP in both TP4 and NS3, neither had information on the the formating for these commands. I am guessing that when you stated:

    DEFINE_MUTUALLY_EXCLUSIVE

    ( [dvTP_1,1] .. [dvTP_1,10] )

    that the 1,1 and 1,10 indicate port,channel so if my TP4 file button programming tab indicates the the buttons I am interested in making MUTUALLY_EXCLUSIVE is PORT 12 and CHANNEL 145 and CHANNEL 147, I would use the following in the main.axs file:

    DEFINE_MUTUALLY_EXCLUSIVE

    ( [dvTP_12,145] .. [dvTP_12,147] ) (understanding that there should not be a channel 146 button UNLESS i want it included in this exclusive set.

    Sinc I could not find any reference to these commands in the help files i am also assuming the Latching command would work like this:

    DEFINE_LATCHING
    ([dvTP_12,145]..[dvTP_12,147])

    this will make all buttons on port 12 channels 145-147 latching.

    Are my assumptions correct?

    I very much appreciate your assistance.
  • John GonzalesJohn Gonzales Junior Member Posts: 609
    Your assumptions look correct. Also, there are 4 different help files in NS3, you would want to look under "Help->Netlinx Keywords Help".

    --John
  • John GonzalesJohn Gonzales Junior Member Posts: 609
    And by the way, to make just channels 145 and 147 exclusive it would look like this:
    DEFINE_MUTUALLY_EXCLUSIVE
    
    ( [dvTP_12,145], [dvTP_12,147] )
    

    --John
  • rmjstsrmjsts Junior Member Posts: 19
    Thanks

    Thank you Eric and John, I will try this out tomorrow once on site with system. Looks easy enough, I did not think to look in the Keywords section of Help.
  • trustworthytrustworthy Junior Member Posts: 74
    The "dvTP_12" will be whatever you've defined that particular device as... thus

    DEFINE_DEVICE
    dvTP_01  =  10101:1:0
    dvTP_02  =  10101:2:0
    dvTOUCH_PANEL_PORT_NUMBER   =   10101: (*PORT NUMBER*) : 0
    
    

    but then if you want to include more than one TP you"ll have to rethink the device name. Thankfully the search and replace works quite well.
  • rmjstsrmjsts Junior Member Posts: 19
    Will this work instead of the way I was looking at it:

    DEFINE_LATCHING
    ([dvTP1_ACONF1, 145], [dvTP1_ACONF1, 147])

    DEFINE_MUTUALLY_EXCLUSIVE
    ([dvTP1_ACONF1, 145], [dvTP1_ACONF1, 147])

    Where ACONF1 has already been defined in the Device definitions section.
    and where 145 and 147 are the channels I am trying to affect, or do I need to state the button/function name?


    Thanks to all again.. This is a great learning experience. I look forward to becoming much better in time.
  • trustworthytrustworthy Junior Member Posts: 74
    If you've defined dvTP1_ACONF1 correclty it should work fine. If you're stuck post the relevant code portions. Use open square bracket, code, close square bracket before your code insertion, then open square bracket, forward slash code, close square bracket after the code section.

    I can't display it because it will break out that section!
  • rmjstsrmjsts Junior Member Posts: 19
    Just to be sure here is the relevant code:

    DEFINE_DEVICE
    // Touch Panels
    dvTP1 = 10001:1:0
    dvTP1_DVR1 = 10001:10:0
    dvTP1_MOTOR1 = 10001:11:0
    dvTP1_ACONF1 = 10001:12:0
    dvTP1_MODE_WelcometoClarkNexsen1 = 10001:15:0
    dvTP1_NAV_Components1 = 10001:20:0
    dvTP1_NAV_System1 = 10001:22:0
    dvTP1_SUBFEATURE_VolumeController1 = 10001:21:0
    dvTP1_PREAMP1 = 10001:19:0
    dvTP1_NAV_ConferencePhone1 = 10001:16:0
    dvTP1_NAV_Computer1 = 10001:17:0
    dvTP1_NAV_DVDVCR1 = 10001:18:0
    dvTP1_VPROJ1 = 10001:14:0
    dvTP1_SWT1 = 10001:13:0

    // Other Devices
    dvDVR1 = 5001:5:0
    vdvDVR1 = 41002:1:0
    dvMOTOR1 = 5001:7:0
    vdvMOTOR1 = 41003:1:0
    dvACONF1 = 5001:1:0
    vdvACONF1 = 33001:1:0
    dvPREAMP1 = 5001:6:0
    vdvPREAMP1 = 41004:1:0
    dvVPROJ1 = 5001:3:0
    vdvVPROJ1 = 33002:1:0
    dvSWT1 = 5001:2:0
    vdvSWT1 = 33003:1:0

    DEFINE_VARIABLE

    // Touch Panel Arrays
    VOLATILE DEV dvTP[] = { dvTP1 }
    VOLATILE DEV dvTP_ACONF1[] = { dvTP1_ACONF1 }
    VOLATILE DEV dvTP_DVR1[] = { dvTP1_DVR1 }
    VOLATILE DEV dvTP_MOTOR1[] = { dvTP1_MOTOR1 }
    VOLATILE DEV dvTP_PREAMP1[] = { dvTP1_PREAMP1 }
    VOLATILE DEV dvTP_SWT1[] = { dvTP1_SWT1 }
    VOLATILE DEV dvTP_VPROJ1[] = { dvTP1_VPROJ1 }

    DEFINE_LATCHING
    //"MICs" Latching group
    ([dvTP1_ACONF1, 145], [dvTP1_ACONF1, 147])

    DEFINE_MUTUALLY_EXCLUSIVE
    //"MICs" mutually exclusive group
    ([dvTP1_ACONF1, 145], [dvTP1_ACONF1, 147] )

    Is this correct???

    Thank you for your help.
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    Is the goal of this to make a latching control for a mic?

    If this is the case you might think about this another way.

    I'd just create a variable flag in the program to do it.

    There are many ways to do this. I'll just do a simple one to illustrate
    DEFINE_DEVICE
    
    dvTP_1 = 10001:01;0
    
    dv_Mic_Pre = 5001:01:0
    
    DEFINE_VARIABLE
    
    volatile integer Mic_Stat
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP_1,1] // mute/unmute mic
    {
    push:
      {
      if(!Mic_Stat) // Mic is off - please turn on
        {
        // code to turn on mic
        }
      else // mic is on - please turn off
        {
        // code to turn off mic 
        }
      Mic_Stat=!Mic_Stat
      }
    }
    
    data_event[dv_Mic_Pre ]
    {
    string:
      {
      if(find_string(data.text,'mic is on string',1))
        {
        Mic_Stat=1
        }
      if(find_string(data.text,'mic is off string',1))
        {
        Mic_Stat=0
        }
      }
    }
    
    DEFINE_PROGRAM
    
    
    wait 10
      {
      [dvTP_1,1]=Mic_Stat
      }
    
    

    This will make the latching happen automatically. If the preamp provides feedback, you can tie this to the state of the variable so the feedback will be real.

    The TP Button Feedback statement in DEF_PROG can be handled in a multitude of ways. This particular version updates the button feedback every second only if a change in state has occured. It does not send out 'button_off' every second.
  • rmjstsrmjsts Junior Member Posts: 19
    Yes I need to latch the buttons. Customer wants to know if the MICs are on or off on thier Polycom Vortex conferencer. I also need them mututally exclusive to ensure that the buttons are NEVER on/off at the same time. There are 2 buttons, MIC ON and MIC OFF. I can make this a single button such as MIC MUTE, but they want a 2 separate buttons. ON is GREEN and OFF is RED so they can quickly glance and see the MIC status since the codec is actually in an equipment closet and not readily available. I had thought of a single button set to blink so that it grabs their attention more quickly, however they had some older ******** systems in some other conference rooms that have the dual buttons and it is what they are used to. I am learning quite at but here, thanks gentlemen....
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    rmjsts wrote: »
    Yes I need to latch the buttons. Customer wants to know if the MICs are on or off on thier Polycom Vortex conferencer. I also need them mututally exclusive to ensure that the buttons are NEVER on/off at the same time. There are 2 buttons, MIC ON and MIC OFF. I can make this a single button such as MIC MUTE, but they want a 2 separate buttons. ON is GREEN and OFF is RED so they can quickly glance and see the MIC status since the codec is actually in an equipment closet and not readily available. I had thought of a single button set to blink so that it grabs their attention more quickly, however they had some older ******** systems in some other conference rooms that have the dual buttons and it is what they are used to. I am learning quite at but here, thanks gentlemen....

    Well, there is an easy way to use the feedback statement to do this as well.
    DEFINE_PROGRAM
    
    wait 10
      {
      [dvTP_1,1]=Mic_Stat
      [dvTP_1,2]=!Mic_Stat  // or [dvTP_1,2]=![dvTP_1,1]
      }
    
    
  • viningvining X Member Posts: 4,358
    rmjsts wrote:
    Yes I need to latch the buttons. Customer wants to know if the MICs are on or off on thier Polycom Vortex conferencer.
    Indicating MIC status on a TP doesn't require a button to be latching or mutually exclusive. As eric pointed out simply tracking a variable will suffice. Ideally you don't want to set the state of this variable or "the buttons" based on a button push but rather feedback from the device. When the device respond in what ever manner of repsonse it gives you to indicate the mic is on your tracking variable should be set to 1 and when it sends a response which would indicate the mic is off then set this variable to 0. Make this variable persistent so it retains its value after a reboot if you need but I've never used the define_latching and if I need buttons to be mutually exclusive I feels that's easier to do in code the way eric has demonstrated.

    There's really no need for define_latching or define_mutally_exclusive. It's actually easier and more flexible with out them.
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    I would strongly recommend making your latching and feedback reflect the state of the microphones, not the button. If anything goes screwy with your code or the panel (say your panel gets rebooted, for example), you may have a live mic somewhere with a red indicator, and no one the wiser till they start cussing in it ...
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    DHawthorne wrote: »
    I would strongly recommend making your latching and feedback reflect the state of the microphones, not the button. If anything goes screwy with your code or the panel (say your panel gets rebooted, for example), you may have a live mic somewhere with a red indicator, and no one the wiser till they start cussing in it ...

    Ooooh, I could tell some stories. :D
  • rmjstsrmjsts Junior Member Posts: 19
    Getting there....

    OK I hear what you are saying and I actually thought of some this myself today. I did try to get the latching to work but it did not. We cut it to just one button for the MICs ON state shows on and OFF states shows off. I used DEFINE_LATCHING section and set the channel to latching

    DEFINE_LATCHING
    ([ACONF1,145])

    AND I SEE WHERE PART OF THE PROBLEM IS NOW AS I LOOK AT THIS: THIS SHOULD LOOK LIKE THIS:

    DEFINE_LATCHING
    ([dvACONF1,145])
    I forgot the dv (device indicator)


    I set the button feedback to "channel" and nothing happens. I am sure I just did this wrong, but I was looking at this as the DEFINE_LATCHING sets the actual channel state to latching and the button feedback being set to channel monitors this state and reacts appropriately. Again I am wrong and it did not work. Since this is a single button situation this is a toggling event command for the codec. I can use device queries to get exact state of the mic inputs individually or as a group, in this case I will use the entire group query. Then see about using the info Eric submitted to use the exact channel state for the button. In this case, in TP4 button programming would be set to "Channel" I am assuming. I am a little confused on the example Eric provided (sorry for the ignorance) but I am trying to follow the code and I do not follow where the program is getting the channel state from.

    I do not know what the data.text portion ( I know this is just a placeholder for what I would have to insert, just do not know what to insert here) would be below.

    data_event[dv_Mic_Pre ]
    {
    string:
    {
    if(find_string(data.text,'mic is on string',1))
    {
    Mic_Stat=1
    }
    if(find_string(data.text,'mic is off string',1))
    {
    Mic_Stat=0
    }
    }
    }

    I SERIOUSLY DOUBT THIS ...BUT: could it be as simple as: dvACONF1.response expected for this condition.

    I know the other part above this for the code to turn on and off in the IF/ELSE statements the // has to be dropped so the code is not considered a remark statement, and I have that info. The rest looks like I can understand it.

    Sorry I was not trying to open such a can of worms for you guys on this, and I HIGHLY appreciate everyone's time and efforts.
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    rmjsts wrote: »
    OK I hear what you are saying and I actually thought of some this myself today. I did try to get the latching to work but it did not. We cut it to just one button for the MICs ON state shows on and OFF states shows off. I used DEFINE_LATCHING section and set the channel to latching

    DEFINE_LATCHING
    ([ACONF1,145])

    AND I SEE WHERE PART OF THE PROBLEM IS NOW AS I LOOK AT THIS: THIS SHOULD LOOK LIKE THIS:

    DEFINE_LATCHING
    ([dvACONF1,145])
    I forgot the dv (device indicator)


    I set the button feedback to "channel" and nothing happens. I am sure I just did this wrong, but I was looking at this as the DEFINE_LATCHING sets the actual channel state to latching and the button feedback being set to channel monitors this state and reacts appropriately. Again I am wrong and it did not work. Since this is a single button situation this is a toggling event command for the codec. I can use device queries to get exact state of the mic inputs individually or as a group, in this case I will use the entire group query. Then see about using the info Eric submitted to use the exact channel state for the button. In this case, in TP4 button programming would be set to "Channel" I am assuming. I am a little confused on the example Eric provided (sorry for the ignorance) but I am trying to follow the code and I do not follow where the program is getting the channel state from.

    I do not know what the data.text portion ( I know this is just a placeholder for what I would have to insert, just do not know what to insert here) would be below.

    data_event[dv_Mic_Pre ]
    {
    string:
    {
    if(find_string(data.text,'mic is on string',1))
    {
    Mic_Stat=1
    }
    if(find_string(data.text,'mic is off string',1))
    {
    Mic_Stat=0
    }
    }
    }

    I SERIOUSLY DOUBT THIS ...BUT: could it be as simple as: dvACONF1.response expected for this condition.

    I know the other part above this for the code to turn on and off in the IF/ELSE statements the // has to be dropped so the code is not considered a remark statement, and I have that info. The rest looks like I can understand it.

    Sorry I was not trying to open such a can of worms for you guys on this, and I HIGHLY appreciate everyone's time and efforts.

    data.text is a legit thing. It is part of the data_Event structure. highlight DATA_EVENT and hit F1 and it'll take you to the section on DATA_EVENTS.

    go to the bottom of that page and click 'EVENT HANDLERS'

    go to that page and scroll to the bottom of that. You see a link to the event handlers for data_events.

    Those all work. While you're at it you might check out all the event. There's a whole world of stuff you'll find very useful.
  • kbeattyAMXkbeattyAMX Junior Member Posts: 358
    rmjsts wrote: »
    OK I hear what you are saying and I actually thought of some this myself today. I did try to get the latching to work but it did not. We cut it to just one button for the MICs ON state shows on and OFF states shows off. I used DEFINE_LATCHING section and set the channel to latching

    DEFINE_LATCHING
    ([ACONF1,145])

    AND I SEE WHERE PART OF THE PROBLEM IS NOW AS I LOOK AT THIS: THIS SHOULD LOOK LIKE THIS:

    DEFINE_LATCHING
    ([dvACONF1,145])
    I forgot the dv (device indicator)


    I set the button feedback to "channel" and nothing happens. I am sure I just did this wrong, but I was looking at this as the DEFINE_LATCHING sets the actual channel state to latching and the button feedback being set to channel monitors this state and reacts appropriately. Again I am wrong and it did not work. Since this is a single button situation this is a toggling event command for the codec. I can use device queries to get exact state of the mic inputs individually or as a group, in this case I will use the entire group query. Then see about using the info Eric submitted to use the exact channel state for the button. In this case, in TP4 button programming would be set to "Channel" I am assuming. I am a little confused on the example Eric provided (sorry for the ignorance) but I am trying to follow the code and I do not follow where the program is getting the channel state from.

    I do not know what the data.text portion ( I know this is just a placeholder for what I would have to insert, just do not know what to insert here) would be below.

    data_event[dv_Mic_Pre ]
    {
    string:
    {
    if(find_string(data.text,'mic is on string',1))
    {
    Mic_Stat=1
    }
    if(find_string(data.text,'mic is off string',1))
    {
    Mic_Stat=0
    }
    }
    }

    I SERIOUSLY DOUBT THIS ...BUT: could it be as simple as: dvACONF1.response expected for this condition.

    I know the other part above this for the code to turn on and off in the IF/ELSE statements the // has to be dropped so the code is not considered a remark statement, and I have that info. The rest looks like I can understand it.

    Sorry I was not trying to open such a can of worms for you guys on this, and I HIGHLY appreciate everyone's time and efforts.

    I'd write it this way...
    data_event[dv_Mic_Pre ]
    {
      string:
      {
        if(find_string(data.text,'mic is on string',1)) on[dv_Mic_Pre ,1]
        if(find_string(data.text,'mic is off string',1)) off[dv_Mic_Pre ,1]
      }
    }
    
    channel_event[dv_Mic_Pre ,1]
    {
      on: { Items to execute if the mute is on }
      off: { Items to execute if the mute is off }
    }
    
    DEFINE_PROGRAM
    
    [ACONF1,145] = [dv_Mic_Pre ,1]
    
    

    Report the status of the Mic to the physical device used in the netlinx then update the TP in Mainline or a timeline event. Then use a channel_event to run stuff off of the event of a mic muting and unmuting. All of this is driven from actual feedback from the Dv_Mic_Pre.
Sign In or Register to comment.