Home AMX User Forum NetLinx Studio

1 Array, 20 Projectors and so many lines of code!

I am using a EIB/KNX Gateway to monitor 20 rooms each with one 6 button panel. Three buttons on each panel control a projector ( on/off, vga1 and vga2 )

The only thing that is passed on from the CommTec module is one array (lEIB_Value[3000]) which I monitor for button events from the panels (non-amx panels)
I created a Hitachi projector module to handle the IP communications, commmands, responses from the projector and button events. Used it for many projects.

So I ask: What method would you use to minimize the code and utilize the module?
I am kid of blocked here. Of course one could just program each lEIB_Value[x] and what it does, in the main program, but that?s not challenging enough is it ;)

Button 1 Room 1 = lEIB_Value[1]
Button 2 Room 1 = lEIB_Value[2]
Button 3 Room 1 = lEIB_Value[3]
Button 1 Room 2 = lEIB_Value[4]
Button 2 Room 2 = lEIB_Value[5]
Button 3 Room 2 = lEIB_Value[6]
and so on for 18 more rooms.

Comments

  • Hm, maybe an idea (shoot from the hip, may need some more work in detail):
    // this will update an EIB related button if a new value is incoming
    DEFINE_DEVICE
    vdvEIB = 33001:1:0
    
    DEFINE_VARIABLE
    INTEGER nButtons[] = { 1,2,3,4,5,6,7 } // order is room1button1, r1b2, r1b3, r2b1, etc
    INTEGER nButtonStates[8] // use same length like the button array 
    
    DEFINE_EVENT
    DATA_EVENT[vdvEIB]
    {
    	STRING: // using the String feedbacks or the module
    	{
    		STACK_VAR INTEGER nIdx
    		STACK_VAR CHAR sCmd[20]
    		sCmd = REMOVE_STRING(DATA.TEXT,"'='",1)
    		SWITCH(sCmd)
    		{
    			CASE 'SET=': // new value, may be 'SET=2:1' // 2nd table indes, value 1
    			CASE 'VAL=': // updated value
    			{
    				nIdx = ATOI(DATA.TEXT) // get table index
    				REMOVE_STRING(DATA.TEXT,"':'",1)
    				nButtonStates[nidx] = ATOI(DATA.TEXT) // get the value
    				[dvPanel,nButtons[nIdx]] = nButtonStates[nidx]
    			}
    		}
    	}
    }
    
    Would be my favorite, because the less system load and feedback close in time
    This will update automatically one of buttons 1..8 of nButtons if a change or update of EIB table index 1..8 is incoming. To update the buttons on system start or panel online, you may have request the corresponding EIB addresses with the function EIBGet() manually.

    Another idea may be just to create a loop, fired every x seconds, to update the 20x3 buttons from the lEIBvalues array. For this you also may have to arrange button channels and EIB table corresponding.
  • Thanks.

    I like this method and am going to try it.
    I?ll keep ya?ll posted.
Sign In or Register to comment.