Home AMX User Forum AMXForums Archive Threads AMX Applications and Solutions

Stacking buttons : AMX vs. ********

The college I work at has both AMX and ******** controlled "smart rooms". The powers that be want all rooms to have identical functionality( or close). ******** uses that wonderful logic " OR" to allow one touch on panel doing a variety of things. Choosing any medis source( dvd/vcr/LD) will cause the system to power up /projector to power up /lights down /screen down etc. The AMX programs I have written to also accomplish this require me to stack buttons up as below:
PUSH[TP,13]
PUSH[TP,15]
PUSH[TP,14]
PUSH[TP,18]
PUSH[TP,71] (*RACK/PROJECTOR POWER ON FROM CHOOSING ANY SOURCE*)
{

ON[RELAY1,RACK_PWR]
CALL 'SONY ON'
STATUS=1
PULSE[RELAY1,SCREEN_DN]
}

I am not a great programmer by any stretch and it is a small part of my job so you may laugh at this but is not there a better way to turn everything on? The Powers that be would like the Amx to run like the ********. So upon any source choice the rack/proj fire up. I have written code that can accomplish this upon an initial push at the main page but am hoping to do this upon a button choice without having to stack these buttons one atop another.
Any ideas are more than welcome . Thanks in advance.
Stewart Lane

Comments

  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    Stewart wrote: »
    The college I work at has both AMX and ******** controlled "smart rooms". The powers that be want all rooms to have identical functionality( or close). ******** uses that wonderful logic " OR" to allow one touch on panel doing a variety of things. Choosing any medis source( dvd/vcr/LD) will cause the system to power up /projector to power up /lights down /screen down etc. The AMX programs I have written to also accomplish this require me to stack buttons up as below:
    PUSH[TP,13]
    PUSH[TP,15]
    PUSH[TP,14]
    PUSH[TP,18]
    PUSH[TP,71] (*RACK/PROJECTOR POWER ON FROM CHOOSING ANY SOURCE*)
    {

    ON[RELAY1,RACK_PWR]
    CALL 'SONY ON'
    STATUS=1
    PULSE[RELAY1,SCREEN_DN]
    }

    I am not a great programmer by any stretch and it is a small part of my job so you may laugh at this but is not there a better way to turn everything on? The Powers that be would like the Amx to run like the ********. So upon any source choice the rack/proj fire up. I have written code that can accomplish this upon an initial push at the main page but am hoping to do this upon a button choice without having to stack these buttons one atop another.
    Any ideas are more than welcome . Thanks in advance.
    Stewart Lane

    Is this system an Axcess system or Netlinx. that'll help with the answer
    e
  • jjamesjjames Just another dude Posts: 2,906
    Well - it appears to be Axcess code, but in Netlinx I'd make a button array (INTEGER Buttons[]={13,14,15,18,71}) and then do a CALL with all that stuff in it. So it might look like this in Axcess (keep in mind, I've never programmed Axcess):
    DEFINE_CONSTANT
    INTEGER Buttons[] = 
    {
       13
      ,14
      ,15
      ,18
      ,71
    }
    
    . . . . .
    
    DEFINE_CALL 'The Power Sequence Please'
    {
      ON[RELAY1,RACK_PWR]
      CALL 'SONY ON'
      STATUS=1
      PULSE[RELAY1,SCREEN_DN]
    }
    
    . . . . .
    
    PUSH[TP,Buttons]
    {
      CALL 'The Power Sequence Please'
      // Then do whatever else you need to do - probably another CALL for the source select
    }
    

    I think it's a general rule, if not it should be, to make a call or function if something is used more than once in code. Keeps it clean and simple in my opinion.

    Here's my source select button I use in Netlinx. It basically consists of assigning variables and calling a function that everything is in.
    BUTTON_EVENT[dv_TP,nSOURCE_BTNS] // CHANNELS 321-360
    {
       PUSH:
       {
    		STACK_VAR INTEGER nPNL
    		STACK_VAR INTEGER nSRC
    		
    		nPNL=GET_LAST(dv_TP)
    		nSRC=GET_LAST(nSOURCE_BTNS)
    		
    		// Is the touch panel active?
    		IF (!nTP_DISABLE[nPNL])
    		{
    			// Page flip if we're not powering up/down a source already
    			IF((!nROOM_PWR_UP[nPNL_AV[nPNL]]) && (!nROOM_PWR_DN[nPNL_AV[nPNL]]) &&
    				  nAV_ZONE_SOURCE[nPNL_AV[nPNL]] != nSRC)
    			{
    				// Selecting a new source, assign the variables
    				nLAST_ZONE_SOURCE[nPNL_AV[nPNL]] = nAV_ZONE_SOURCE[nPNL_AV[nPNL]];
    				nAV_ZONE_SOURCE[nPNL_AV[nPNL]]=nSRC;
    				nCONTROL_SOURCE[nPNL]=nSRC;
    				
    				// Flip the page
    				[b][color=red]fnGET_SOURCE_PAGE[/color][/b](nPNL,0);
    				
    				// Do Magic!
    				[b][color=red]fnROOM_POWER[/color][/b](nPWR_ON,nPNL,0);
    			}
    			
    			// Reinialize room
    			ELSE IF((!nROOM_PWR_UP[nPNL_AV[nPNL]]) && (!nROOM_PWR_DN[nPNL_AV[nPNL]]) &&
    				  nAV_ZONE_SOURCE[nPNL_AV[nPNL]] == nSRC)
    			{
    				// Flip the pages
    				[b][color=red]fnGET_SOURCE_PAGE[/color][/b](nPNL,0);
    				
    				// Do Magic!
    				[b][color=red]fnROOM_POWER[/color][/b](nPWR_ON,nPNL,0);
    			}
    		}
    		// Simmer down there - you can't select anything yet!
    		ELSE
    			SEND_COMMAND dv_TP[nPNL],'ADBEEP';
       }
    }
    
  • kbeattyAMXkbeattyAMX Junior Member Posts: 358
    Stewart wrote: »
    The college I work at has both AMX and ******** controlled "smart rooms". The powers that be want all rooms to have identical functionality( or close). ******** uses that wonderful logic " OR" to allow one touch on panel doing a variety of things. Choosing any medis source( dvd/vcr/LD) will cause the system to power up /projector to power up /lights down /screen down etc. The AMX programs I have written to also accomplish this require me to stack buttons up as below:
    PUSH[TP,13]
    PUSH[TP,15]
    PUSH[TP,14]
    PUSH[TP,18]
    PUSH[TP,71] (*RACK/PROJECTOR POWER ON FROM CHOOSING ANY SOURCE*)
    {

    ON[RELAY1,RACK_PWR]
    CALL 'SONY ON'
    STATUS=1
    PULSE[RELAY1,SCREEN_DN]
    }

    I am not a great programmer by any stretch and it is a small part of my job so you may laugh at this but is not there a better way to turn everything on? The Powers that be would like the Amx to run like the ********. So upon any source choice the rack/proj fire up. I have written code that can accomplish this upon an initial push at the main page but am hoping to do this upon a button choice without having to stack these buttons one atop another.
    Any ideas are more than welcome . Thanks in advance.
    Stewart Lane

    AMX does OR also...

    if ((push_channel = 13) or
    (push_channel = 15) or
    (push_channel = 14) or
    (push_channel = 18) or
    (push_channel = 71))
    {
    call 'Stuff to Run'
    }

    I wouldn't write it this way. Only making a point...
  • StewartStewart Junior Member Posts: 37
    Amx button stacking versus ******** "OR"

    Indded it is Access programming
    we have not moved to Netlinx and instead went with ********
    Thanks for the replies
    Any other suggestions are very welcome :)
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    Stewart wrote: »
    Indded it is Access programming
    we have not moved to Netlinx and instead went with ********
    Thanks for the replies
    Any other suggestions are very welcome :)

    This is not meant to be snarky...

    but Netlinx is much better at handling this kind of stuff. It's too bad you couldn't have switched over.


    I think you'd have been quite happy with the Netlinx environment.
  • StewartStewart Junior Member Posts: 37
    Access versus Netlinx versus ********

    I agree . We decided to move to ********/Roomview and never linked the Access to the net so no Netlinx programming :(
    Now we have roughly 100 " smartrooms" with AMX/******** and for small spaces Extron
    Back to the question. I wrote the push channel and it compiles fine and I am confident this has a future , Thanks everyone!!!!. One more question
    Can I use a variable and not write the Push_Channel over and over?
    Again I am doing this perhaps once a month and am very rusty.....
  • DHawthorneDHawthorne Old Timer Posts: 4,584
    Stewart wrote: »
    I agree . We decided to move to ********/Roomview and never linked the Access to the net so no Netlinx programming :(
    Now we have roughly 100 " smartrooms" with AMX/******** and for small spaces Extron
    Back to the question. I wrote the push channel and it compiles fine and I am confident this has a future , Thanks everyone!!!!. One more question
    Can I use a variable and not write the Push_Channel over and over?
    Again I am doing this perhaps once a month and am very rusty.....

    PUSH_CHANNEL *is* a variable. It's a global variable automatically populated by the last channel event.
  • StewartStewart Junior Member Posts: 37
    Amx button stacking versus ******** "OR"

    When i place PUSH_CHANNEL in the DEFINE VARIABLE field it changes to blue instead of red
    Man I am out of practice.
  • kbeattyAMXkbeattyAMX Junior Member Posts: 358
    Push_channel is a system variable. It does not need to be defined.
  • StewartStewart Junior Member Posts: 37
    Amx Problems continue

    IF ((PUSH_CHANNEL =13) OR
    (PUSH_CHANNEL =14) OR
    (PUSH_CHANNEL =15) OR
    (PUSH_CHANNEL =7) OR
    (PUSH_CHANNEL =8)) (*POWER ON*)
    {
    ON[TP,40]
    OFF[TP,43]
    ON[RELAY1,RACK_PWR]

    CALL 'SONY ON'
    STATUS=1
    OFF[TP,19]
    ON[TP,20]
    PULSE[RELAY1,SCREEN_DN]
    }



    Help please . This code seems to work well for the Tp 7 and TP 8 button presses ) comp and Aux inputs)
    That is I can get the Projector to fire along with rack and screen etc. However any button press of 13, 14, 15, will not turn the projector on. tp 7 and 8 have page flips, Th e 13,14, 15 are for the dvd/vcr/ld and there is also a need ( vcr for example) to switch the Extron see below:



    PUSH[TP,13] (*SELECT VHS*)
    {
    VIDEO_INPUT=1
    VIDEO_OUTPUT=3
    AUDIO_INPUT=1
    AUDIO_OUTPUT=1
    CALL 'DO SWITCH'
    CALL 'SONY VIDEO'

    ON[TP,13]
    }
    I have tried waits /tried placing another system call for 'sony on' in the above snippet . I am very puzzled.
    I have been at this for 5 hrs now and cannot figure what is going on .
    I can send any snippets needed just cannot figure this out
  • AvophileAvophile Junior Member Posts: 70
    I am not sure if this is even relevant for Access programming, but are the port numbers for channels 13, 14, and 15 the same as the port numbers for channels 7 and 8 in the touch panel file?
  • kbeattyAMXkbeattyAMX Junior Member Posts: 358
    I thought the original question was "Is there another way to program the stacked pulses?". Because it seems to be simple in Crestr0n to use a OR symbol.

    I responded saying that AMX has OR statments. Because it was Stacked pushes I made the assumption that it was Axcess. I suggested push_channel as a way to avoid stacked pulses. But it seems there was more to the question originally asked.

    If you have different Tps with different buttons and this is for one specific TP, there is a system variable called push_device. So just do..

    Of course this is in the DEFINE_PROGRAM section of your code.
    If (push_device = TP)
    {
      if (push_channel.........._
      {
      }
    }
    

    I hope this is what you're asking...
  • StewartStewart Junior Member Posts: 37
    Amx button stacking versus ******** "OR"

    If (push_device = TP)
    {
    if (push_channel.........._
    {
    }
    }
    Sorry i am a bit frazzled
    The push_channel seems to work but I am wondering why the 3 tp channels ( 13,14,15) will not turn projector on
    Further down in mainline is the code to switch sources ( this is tp,13 for the vcr)
    PUSH[TP,13] (*SELECT VHS*)
    {
    VIDEO_INPUT=1
    VIDEO_OUTPUT=3
    AUDIO_INPUT=1
    AUDIO_OUTPUT=1
    CALL 'DO SWITCH'
    CALL 'SONY VIDEO'
    WAIT 4 CALL 'SONY UNMUTE'
    ON[TP,13]
    }

    So , as you can see whenever i push the vcr button i am trying to do several things . along with after everything fires up doing some switching
    DVd LD and the vcr code above is all similiar and it it this code that i thought might be interfering with proj powering up as the button pushs tp, 7 and 8 do turn on the projector and have no other ancilliary switching as they do a page flip and then you can choose buttons to make the switching work.
    Could you possibly go me on stage further and elaborate on the code snippet you sent?
  • jjamesjjames Just another dude Posts: 2,906
    Just curious as I've never programmed Axcess . . . but does it not have DEV_CHAN or INTEGER arrays?
  • StewartStewart Junior Member Posts: 37
    you got me / I think so
  • kbeattyAMXkbeattyAMX Junior Member Posts: 358
    It's possible that the CALL 'SONY VIDEO' is messing up the power on for the Sony Projector. I don't know how the DEFINE_CALL is written. Are you writing this code from scratch or are you just patching it...
  • dchristodchristo Junior Member Posts: 177
    jjames wrote: »
    Just curious as I've never programmed Axcess . . . but does it not have DEV_CHAN or INTEGER arrays?

    Axcess has integer arrays, but not DevChans.

    --D
  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    dchristo wrote: »
    Axcess has integer arrays, but not DevChans.

    --D
    Also of note, Axcess only allows for up to 2 dimensional arrays. Netlinx will go out to 5.
Sign In or Register to comment.