whole House matrix questions
The system i am doing right now is basically an 8x8 matrix to as many areas for viewing or listening and the way the client wanted the hand full of TPs programmed, is to pick an area and then on the next screen pick a source for the area from any TP. all the TPs would be the same and you would basically be able to do anything from any of them.
I figured an exp programmer would use some type of condtional statement to nest all the matrix/source codes and activate the different code blocks depending on the area and source selected,etc. I was thinking maybe switch/case? im not sure and keep in mind im a noob(this being my first project).
obviously the cheap way to do this would be to multiple source pages, etc but I know thats not the way to do it here. an example of code would really help me! thanks!
I figured an exp programmer would use some type of condtional statement to nest all the matrix/source codes and activate the different code blocks depending on the area and source selected,etc. I was thinking maybe switch/case? im not sure and keep in mind im a noob(this being my first project).
obviously the cheap way to do this would be to multiple source pages, etc but I know thats not the way to do it here. an example of code would really help me! thanks!
Comments
Create an array that has the current zone controlled for each touch panel.
So, if there are 5 TPs, the the array Current_Audio_Zone would be 5 cells wide. (one for each TP.)
DEFINE_VARIABLE volatile dev Audio_TPs[]= { dv_TP_01 ,dv_TP_02 ,dv_TP_03 ,dv_TP_04 ,dv_TP_05 }The client selects the zone they wish to control which sets the array Current_Audio_Zone [this TP] to whichever output they selected.
DEFINE_VARIALBE volatile integer Current_Audio_Zone[5] // number of TPs. volatile integer Audio_Zone_Buttons[]= {11,12,13,14,15,16,17,18} DEFINE_EVENT button_event[Audio_TPs,Audio_Zone_Buttons] { push: { Current_Audio_Zone[get_last(Audio_TPs)]=get_last(Audio_Zone_Buttons) // now we know which audio output zone this TP is controlling. // do something... } }Then when they selected a source for that zone, I'd populate a Current_Source[number of output zones] with that source.
DEFINE_VARIABLE volatile integer Current_Source[8] // current input selected for the 8 outupts. volatile integer Source_Buttons[]= {21,22,23,24,25,26,27,28} DEFINE_EVENT button_event[Audio_TPs,Source_Buttons] { push: { Current_Source[Current_Audio_Zone[get_last(Audio_TPs)]]=get_last(Source_Buttons) // now we know which source is selected for the zone being controlled by this TP // do something... } }Of course, I'm oversimplifying this for the example but this is the basis for it. I'd then create a function to handle the actual switching of the HA switcher and another hink of code to deal with all the popup page navigation and so forth.
Hope that helps.
Also, it lowers the amount of traffic sent back and forth to each panel since the data is only updated or refreshed on panels that are on the matrix or wholehouse pages, and they can call it out of the stored data.
The way I implement it in code is probably overly complex, but it works well for me, is simple for the end user to execute, and system response is very snappy. I use lots of GET_LASTs, and BUTTON.INPUT.DEVICEs, and just simple IF/THEN statements to figure out what to do.
Here's an example of the structure definitions
DEFINE_TYPE STRUCTURE _sPanelInfo { INTEGER nCurrentSource // DSS units 1-12, DVDs 13-20, Tuner 21, CD 22, iPod 23, 24 is unused CHAR cCurrentSource[25] // Descriptive name of source CHAR cOutput[135] // Up to 48 Outputs (digits + the space) CHAR cInput[2] // Up to 99 Inputs (2-digits total) CHAR cVolAbsolute[4] // Volume Absolute String (VA) (-700 to 100) INTEGER nWholehouseRoomSelected // Which Room is selected on this panel } STRUCTURE _sRoomInfo { INTEGER nCurrentSource SINTEGER nCurrentVolume CHAR cCurrentSourceName[30] } DEFINE_VARIABLE _sPanelInfo _PanelInfo[16] // All 16 panels have access to multi-zone _sRoomInfo _RoomInfo[48] // Track data for each of the 48 rooms--John