Home AMX User Forum AMX General Discussion

Sequential Switcher Code

My existing application (a data center) is an Axcess system with an Extron 16x8 matrix RGBHV switcher.

Currently the customer basically just routes individual sources to individual displays, which has worked fine for 5 years.

They are requesting to have sequencing functionality with the existing switcher and components.

They would like to be able to select from 1-16 sources to be sequenced to a single selected display.

They would also like to be able to select 15s,30s,45s,60s delay times.

I have been racking my brain for 2 days trying different things with WAITS, IF statements and SELECT/ACTIVE's, with not much success.

I am able to send the strings just fine, but the timing issues and knowing which sources when they are scattered inputs (ex: 1,5,11) is my main obstacle.

I am not able to find a way for the code to know which sources to skip and still send the right strings at the proper time.

Has anyone ever developed anything like this??

I would appreciate any insight on this type of "user-selected" functionality.

Thanks.

VLCNCRZR

Comments

  • "They would also like to be able to select 15s,30s,45s,60s delay times. "



    Are you saying that each source would have a different delay time?

    Could you populate an array will integers and do it that way?
  • Maybe creating a command queue that stores which device switch to do next and then another piece that tells the axcent 3 when to check the queue next.
  • Once they have selected their sources, such as 1,5,13
    they would select a constant delay time 15,30,45,60s.
    for all the selected sources to be switched.
  • Hi,

    Doesn't something like that work? Sorry for the Axcess syntax, I am a NetLinx guy but I guess it's close enough for understanding...


    DEFINE_VARIABLE
    INTEGER gSwitchSources[16];
    LONG gWait;
    INTEGER gCurSource;

    // Have some gui to fill gSwitchSources with the selected
    // inputs to rotate, i.e.
    // gSwitchSources[1] = 3; gSwitchSources[2] = 5;
    // SET_LENGTH_ARRAY(switchsources) = 2;
    // would mean rotate sources 3 and 5.
    // Have some GUI to fill gWait to the number of 1/10s of
    // seconds to wait

    DEFINE CALL 'NextSource'
    {
    gCurSource = gCurSource + 1;
    SEND_STRING matrix, "activate input gSwitchSources[gCurSource]";
    IF(gCurSource = LENGTH_ARRAY(gSwitchSources))
    { gCurSource = 0; }
    WAIT gWait 'NEXT_SOURCE_WAIT'
    {
    CALL 'NextSource'
    }
    }

    BUTTON_EVENT[..startbutton..]
    {
    gCurSource = 0;
    CALL 'NextSource'
    }


    BUTTON_EVENT[..endbutton..]
    {
    CANCEL_WAIT 'NEXT_SOURCE_WAIT'
    }

    Fred
  • DHawthorneDHawthorne Posts: 4,584
    You can't do recursive CALLs in Axcess, and the LENGTH_ARRAY function is not available.
  • Spire_JeffSpire_Jeff Posts: 1,917
    I'm not real familiar with axcess, but let me see what I can do with wait statements:

    DEFINE_VARIABLE
    INTEGER nSWITCH_SOURCES[16]
    INTEGER nSWITCH_DELAY[16] // value*15=delay in seconds
    INTEGER nWAIT_IN_PROGRESS = 0
    INTEGER nRUN_TIMELINE = 1
    INTEGER nCURRENT_DELAY = 0
    INTEGER nCURRENT_SOURCE = 1
    INTEGER nMAX_SOURCES = 16

    DEFINE_PROGRAM
    IF(!nWAIT_IN_PROGRESS AND nRUN_TIMELINE)
    {
    nWAIT_IN_PROGRESS = 1
    WAIT 150
    {
    nCURRENT_DELAY = nCURRENT_DELAY + 1
    nWAIT_IN_PROGRESS = 0
    }
    IF(nCURRENT_DELAY = nSWITCH_DELAY[nCURRENT_SOURCE])
    {
    nCURRENT_DELAY = 0
    IF(nCURRENT_SOURCE < nMAX_SOURCES)
    {
    nCURRENT_SOURCE = nCURRENT_SOURCE + 1
    }
    ELSE
    {
    nCURRENT_SOURCE = 1
    }
    SEND_COMMAND dvEXTRON,"'CHANGE SOURCE=',ITOA(nSWITCH_SOURCES[nCURRENT_SOURCE])"//SEND STRING TO CHANGE SOURCE

    }
    }




    Now, you'll have to add code to change the values of the arrays. If you need multiple monitors to sequence, it should be easy to do by adding a dimension to each variable and duplicating the IF(nCURRENT_DELAY = nSWITCH_DELAY[nCURRENT_SOURCE]) code for each monitor. Also, being unfamiliar with axcess, this code might not even work or it may need some tweaking. Basically what I am doing is creating a trigger every 15 seconds and when that trigger happens I decide if I need to change the source or do nothing. I hope this helps in some way.

    Jeff
Sign In or Register to comment.