Home AMX User Forum NetLinx Studio

Best way to map IR functions in NL

I am about to program the AV control portion of my Netlinx system and have what seems to be a REALLY basic, but important, quesion. I have many rooms, with many displays, with many sources in each room. I also have many different panel types (touch, MSPs, IR remotes) to actuate the correct IR functions. My question is, what is the best way to structure a "database" of user-interface device/channels to ir-output device/channels. I want to keep my program easily "modifyable" and structures/arrays of confusing numbers, names, devices, and channels at startup seems archaic. I was wondering if there is some slick way to do this pretty basic function. What is the best way to group all the information elements & reference them? Thanks in advance for any input or insight.

Comments

  • DHawthorneDHawthorne Posts: 4,584
    It's not how they said to do it in the programming class I went to, but I find it simplest to map UI to device channel to channel. If the IR channel is 1, the button channel on the panel is 1. If you use the IR templates in IREdit strictly, it's 100% portable from device to device, and if you have an abberant IR file, you only have to edit the panel file a bit to bring it in line. As for sorting out which devices get the signal, you can do it two ways: seperate ports on the panel file for each device, or track it in code. I always track it in code. If I make a variable called dvDeck, and am careful to be certain it is set properly to the device I am controlling at the moment, the button push can be as simple as this:
    BUTTON_EVENT[dvPanel, iButtonArray]
    {
        PUSH : SEND_COMMAND dvDeck, "'SP', BUTTON.INPUT.CHANNEL" ;
    }
    
    If you need more processing than that, branch it out with a SWITCH or SELECT tree, depending on what needs to vary under whatever circumstances (for example, FF transport functions on some devices work on a pulse, some need a steady IR stream as you hold them; for those, and only those, you do an ON for the PUSH handler, and OFF for the RELEASE).

    The way it was recommended in class was to have a seperate DEVCHAN array for the buttons, and another for the IR functions, then match them up by the array indices. I always found that far to convoluted to set up and maintain. Sometimes, easy does it best.
  • DHawthorneDHawthorne Posts: 4,584
    You can expand upon my first post with a multi-room and multi-panel system simply by putting your panels in an array, and making a few tracking variable to hold which audio zone and which device are being controlled by each panel. I usually turn both audio zones and panels into descriptive constants that matches the array indices. For example:
    DEFINE_CONSTANT
    
    ZONE_KITCHEN = 1
    ZONE_FAMILY_RM = 2
    ZONE_BEDROOM = 3
    NUMBER_ZONES = 3
    
    PANEL_KITCHEN = 1
    PANEL_FAMILY = 2
    PANEL_BEDROOM = 3
    
    DEFINE_VARIABLE
    
    VOLATILE DEV dvPanels[] = {dvKitchen_TP, dvFamily_TP, dvBedroom_TP}
    VOLATILE CHAR cZonesByPanel[] = {ZONE_KITCHEN, ZONE_FAMILY_RM, ZONE_BEDROOM}
    VOLATILE DEV dvDeck[NUMBER_ZONES]
    
    You keep track of what room each panel is controlling with cZonesByPanel, and if you want to be able to navigate room-to-room, you change it as you do. If not, you can make it a constant, but the capability is right there. You keep track of what deck is controlled in dvDeck, and the example I posted above becomes:
    BUTTON_EVENT[dvPanels, iButtonArray]
    {
        PUSH : 
        {
            SEND_COMMAND dvDeck[cZonesByPanel[GET_LAST(dvPanels)]],
                "'SP', BUTTON.INPUT.CHANNEL"
        }
    }
    
  • AdaptelAdaptel Posts: 41
    A couple more questions

    Thank you for all your great information. I'm just wondering what the downsides would be to keeping all the button and ir-channel information in a text file or MS database. It could be much easier to modify, but what additional overhead would it add to the system if any?
    I guess I'm making this a bigger deal than it really is because in addition to individual room controls & sources, many of my av sources are also modulated into my comcast cable signal onto channels 86-100 and can be accessed from any room. Should I have two seperate variable arrays for each room.....one to track local video output device (volume & source selections on TV or amplifier) and another to select what source is being used & how to activate it? Thanks again.
Sign In or Register to comment.