Home AMX User Forum AMX Design Tools

2 Touchpanel shared by 2 rooms

winstonmawinstonma Junior MemberPosts: 45
Now I have one AMX NI sharing between 2 rooms. Both rooms have very similar configurations. And there are 2 TPs, both TP can operate both room.

I know duplicating the UIs can makes the life easiler but when it's talking about maintainance. It does matter. So I want to share the UI between 2 rooms. How can I do that? Thanks

Comments

  • DHawthorneDHawthorne Old Timer Posts: 4,584
    winstonma wrote:
    Now I have one AMX NI sharing between 2 rooms. Both rooms have very similar configurations. And there are 2 TPs, both TP can operate both room.

    I know duplicating the UIs can makes the life easiler but when it's talking about maintainance. It does matter. So I want to share the UI between 2 rooms. How can I do that? Thanks
    In a nutshell: make the panels identical, and store them in an array. Create a tracking variable array of the same size that tells which room each panel is currently controlling. When the panels change room (presumably a button press), change the variable in the tracking array to reflect that. Then, whenever a control button is pressed, look up which room is being controlled and send your commands there.
    DEFINE_DEVICES
    
    DEV dvPanel1 = 10001: 1:0
    DEV dvPanel2 = 10002: 1:0
    
    DEFINE_VARIABLES
    
    DEV dvPanels[] = {dvPanel1, dvPanel2}
    CHAR nRoomByPanel[] = {1, 2}     /// default room 1 to panel 1, etc.
    
    DEFINE_EVENTS
    
    BUTTON_EVENT[dvPanels, nRoomChange]   
    // where nRoomChange = array of button channels to change rooms
    {
        PUSH : nRoomByPanel[GET_LAST(dvPanels)] = GET_LAST(nRoomChange)  
    }
    
    BUTTON_EVENT[dvPanels, nControlButtons]
    {
        PUSH :
        {
            SWITCH(nRoomByPanel[GET_LAST(dvPanels)])
            {
                CASE 1 : { // operate on room 1}
                CASE 2 : { // operate on room 2}
            }
        }
    }
    
Sign In or Register to comment.