Home AMX User Forum AMXForums Archive Threads AMX Hardware Endeleo Media Distribution

feedback help

I'm needing help with this code that doesn't display feedback correctly. I have 8 inputs and 24 outputs, I also have a 'all' button to allow the user to send a single input to all monitors at once. I can select any input and send it to any number of outputs and the feedback works as it should. What doesn't work is when I select an input and send it to 'all'.

DEFINE_CALL 'ManualSwitch'
{
if (nSwitchIn < 4)
{
SEND_STRING DisplayDevice[nSwitchOut],"'kb 00 07',$0D"
}
Else if ((nSwitchIn > 3)&&(nSwitchIn < 8))
{
SEND_STRING DisplayDevice[nSwitchOut],"'kb 00 04',$0D"
}
Else if (nSwitchIn = 8)
{
SEND_STRING DisplayDevice[nSwitchOut],"'kb 00 03',$0D"
}
}

BUTTON_EVENT[dvTouch,102] // Send currently selected input to all outputs
{
PUSH:
{
local_var integer j
SEND_COMMAND dvEndeleo1,"'CLALLI',ITOA(nSwitchIn),'O0'" // SEND AUDIO AND VIDEO SWITCH COMMAND
SEND_COMMAND dvEndeleo2,"'CLALLI',ITOA(nSwitchIn),'O0'" // SEND AUDIO AND VIDEO SWITCH COMMAND
SEND_COMMAND dvEndeleo3,"'CLALLI',ITOA(nSwitchIn),'O0'" // SEND AUDIO AND VIDEO SWITCH COMMAND
for(j = 1; j < 25; j++)
{
nSwitchOut = j
nManualFeedback[nSwitchIn][nSwitchOut] = nManualFeedback[nSwitchIn][j]
call 'ManualSwitch'
}
}
}


[dvTouch,1] = nSwitchIn = 1
[dvTouch,2] = nSwitchIn = 2
[dvTouch,3] = nSwitchIn = 3
[dvTouch,4] = nSwitchIn = 4
[dvTouch,5] = nSwitchIn = 5
[dvTouch,6] = nSwitchIn = 6
[dvTouch,7] = nSwitchIn = 7
[dvTouch,8] = nSwitchIn = 8
[dvTouch,20] = nManualFeedback[nSwitchIn][1]
[dvTouch,21] = nManualFeedback[nSwitchIn][2]
[dvTouch,22] = nManualFeedback[nSwitchIn][3]
[dvTouch,23] = nManualFeedback[nSwitchIn][4]
[dvTouch,24] = nManualFeedback[nSwitchIn][5]
[dvTouch,25] = nManualFeedback[nSwitchIn][6]
[dvTouch,26] = nManualFeedback[nSwitchIn][7]
[dvTouch,27] = nManualFeedback[nSwitchIn][8]
[dvTouch,28] = nManualFeedback[nSwitchIn][9]
[dvTouch,29] = nManualFeedback[nSwitchIn][10]
[dvTouch,30] = nManualFeedback[nSwitchIn][11]
[dvTouch,31] = nManualFeedback[nSwitchIn][12]
[dvTouch,32] = nManualFeedback[nSwitchIn][13]
[dvTouch,33] = nManualFeedback[nSwitchIn][14]
[dvTouch,34] = nManualFeedback[nSwitchIn][15]
[dvTouch,35] = nManualFeedback[nSwitchIn][16]
[dvTouch,36] = nManualFeedback[nSwitchIn][17]
[dvTouch,37] = nManualFeedback[nSwitchIn][18]
[dvTouch,38] = nManualFeedback[nSwitchIn][19]
[dvTouch,39] = nManualFeedback[nSwitchIn][20]
[dvTouch,40] = nManualFeedback[nSwitchIn][21]
[dvTouch,41] = nManualFeedback[nSwitchIn][22]
[dvTouch,42] = nManualFeedback[nSwitchIn][23]
[dvTouch,43] = nManualFeedback[nSwitchIn][24]


Any insight will be very appreciated.

-Tim

Comments

  • If you use the code brackets, it's WAY easier to look at the code.
    DEFINE_CALL 'ManualSwitch'
    {
        if (nSwitchIn < 4)
    	{
    	   SEND_STRING DisplayDevice[nSwitchOut],"'kb 00 07',$0D"
    	}	
        Else if ((nSwitchIn > 3)&&(nSwitchIn < 8))
    	{
    	    SEND_STRING DisplayDevice[nSwitchOut],"'kb 00 04',$0D"
    	} 
        Else if (nSwitchIn = 8)
    	{
    	    SEND_STRING DisplayDevice[nSwitchOut],"'kb 00 03',$0D"
    	}
    }
    
    BUTTON_EVENT[dvTouch,102]					//  Send currently selected input to all outputs
    {
        PUSH:
    	{
    	    local_var integer j
    	    SEND_COMMAND dvEndeleo1,"'CLALLI',ITOA(nSwitchIn),'O0'"	// SEND AUDIO AND VIDEO SWITCH COMMAND  
    	    SEND_COMMAND dvEndeleo2,"'CLALLI',ITOA(nSwitchIn),'O0'"	// SEND AUDIO AND VIDEO SWITCH COMMAND
    	    SEND_COMMAND dvEndeleo3,"'CLALLI',ITOA(nSwitchIn),'O0'"	// SEND AUDIO AND VIDEO SWITCH COMMAND
    	    for(j = 1; j < 25; j++)
    		{
    		    nSwitchOut = j
    		    nManualFeedback[nSwitchIn][nSwitchOut] = nManualFeedback[nSwitchIn][j]
    		    call 'ManualSwitch'
    		}
    	}
    }
    
    
    [dvTouch,1] = nSwitchIn = 1
    [dvTouch,2] = nSwitchIn = 2
    [dvTouch,3] = nSwitchIn = 3
    [dvTouch,4] = nSwitchIn = 4
    [dvTouch,5] = nSwitchIn = 5
    [dvTouch,6] = nSwitchIn = 6
    [dvTouch,7] = nSwitchIn = 7
    [dvTouch,8] = nSwitchIn = 8
    [dvTouch,20] = nManualFeedback[nSwitchIn][1]
    [dvTouch,21] = nManualFeedback[nSwitchIn][2]
    [dvTouch,22] = nManualFeedback[nSwitchIn][3]
    [dvTouch,23] = nManualFeedback[nSwitchIn][4]
    [dvTouch,24] = nManualFeedback[nSwitchIn][5]
    [dvTouch,25] = nManualFeedback[nSwitchIn][6]
    [dvTouch,26] = nManualFeedback[nSwitchIn][7]
    [dvTouch,27] = nManualFeedback[nSwitchIn][8]
    [dvTouch,28] = nManualFeedback[nSwitchIn][9]
    [dvTouch,29] = nManualFeedback[nSwitchIn][10]
    [dvTouch,30] = nManualFeedback[nSwitchIn][11]
    [dvTouch,31] = nManualFeedback[nSwitchIn][12]
    [dvTouch,32] = nManualFeedback[nSwitchIn][13]
    [dvTouch,33] = nManualFeedback[nSwitchIn][14]
    [dvTouch,34] = nManualFeedback[nSwitchIn][15]
    [dvTouch,35] = nManualFeedback[nSwitchIn][16]
    [dvTouch,36] = nManualFeedback[nSwitchIn][17]
    [dvTouch,37] = nManualFeedback[nSwitchIn][18]
    [dvTouch,38] = nManualFeedback[nSwitchIn][19]
    [dvTouch,39] = nManualFeedback[nSwitchIn][20]
    [dvTouch,40] = nManualFeedback[nSwitchIn][21]
    [dvTouch,41] = nManualFeedback[nSwitchIn][22]
    [dvTouch,42] = nManualFeedback[nSwitchIn][23]
    [dvTouch,43] = nManualFeedback[nSwitchIn][24]
    
    
    With that said, the problem looks to me like it's in your loop. You're not really changing the nManualFeedback array. Try this:
    for(j = 1; j < 25; j++)
    		{
    		    nManualFeedback[nSwitchIn][j] = 1
    		    call 'ManualSwitch'
    		}
    



    -John
  • Actually, you're probably relying on nSwitchOut to get updated for the call, so you may need to do this:
    for(j = 1; j < 25; j++)
    		{
    		    nSwitchOut = j
    		    nManualFeedback[nSwitchIn][nSwitchOut] = 1
    		    call 'ManualSwitch'
    		}
    

    -John

    Edit: Oops, wasn't paying attention, you show the call in your code snippet. You'll need to use the correction in this post so that nSwitchOut get's updated for each pass of the loop.
  • tkroegertkroeger Posts: 13
    My apologies for the poor structure. I wasn't aware of the code brackets.

    Thanks for the correction. I'll make that change and see how it works. I appreciate the quick response.
  • tkroegertkroeger Posts: 13
    Initial testing yielded better results, but far from perfect.

    Now when I press Input 1 and send to 'all' the feedback works. When I press Input 2, the output feedback shows none selected, which is correct. If I proceed to select 'all' the feedback changes to show Input 2 is now selected to all, which is correct. Now, when I press Input 1 again, it shows to still be going to 'all'.
  • tkroegertkroeger Posts: 13
    Long story short:

    I have 8 Inputs and 24 Outputs, matrix-ed. I just want my feedback to indicate which Input is routed to which Output. Seems simple enough. Sigh.
  • Once the flags are turned on, you're not updating them when the input is disconnected. You need to set the variable nManualFeedback[nSwitchIn][nSwitchOut] back to 0 when you've turned off the input or route a different input to a specific output. You can do it during the switch, or you can trap for status and parse the feedback to update the nManualFeedback variable.

    --John
Sign In or Register to comment.