Home AMX User Forum AMX General Discussion

Quick silly question - onsite - Getting both Momentary and Channel feedback?

Hi there,

I am wondering what to do to get both momentary feedback on a button press and channel
feedback on a single button.
For instance, I have initially programmed up a remote so that it offers channel feedback on the
room icons if they are switched on. This is working fine but I would like icon to also display a
state change when pressed. This works fine when changing the properties to momentary but I
then lose the channel facility which is called by;

[dvTP2,901] = ((cMain1Input == 'CBL / SAT') & (cMain1PowerState = 'On'))
in the Define_Program

Is there a quick way of doing this without some long elaborate IF statement?

Thanks as always in advance,

Mike

Comments

  • TurnipTruckTurnipTruck Posts: 1,485
    BUTTON_EVENT[dvTP,1]
    {
    PUSH:
      {
      TO[BUTTON.INPUT]    //will provide the momentary-type feedback
      }
    }
    
    Your channel-based feedback could be derived many different ways
  • DHawthorneDHawthorne Posts: 4,584
    You have to do it in code, and you probably want to make it at least a 3-state button (multi-state bargraph is the actual button type). As a three-state button, you send a level to it to reflect your state. So if the room in use state is 1, for example, replace your line in DEFINE_PROGRAM with SEND_LEVEL dvTP, <whatever level value you assign the button>, ((cMain1Input == 'CBL / SAT') & (cMain1PowerState = 'On')) . That takes care of the in-use state; for the pressed state, I would set a flag on the PUSH handler, and cancel it on the RELEASE, and make the feedback statement like so:
    IF(bButtonFLag)
        SEND_LEVEL dvTP, <whatever level value you assign the button>, 3;
    ELSE
        SEND_LEVEL dvTP, <whatever level value you assign the button>, ((cMain1Input == 'CBL / SAT') & (cMain1PowerState = 'On'))
    

    This can get cumbersome if you want to deal with a lot of buttons the same way, and I usually set them up in arrays in such a case, then use a FOR loop to run the feedback.
  • Thanks guys, perfect as always. I knew I had seen it somewhere before but could not find it on the forum and wanted to make this panel a bit more responsive to the user. Luckily, its only 6 areas so not going to take too
    long.

    Thanks again!!
  • viningvining Posts: 4,368
    if you only want 2 states you can also create 2 buttons set to the same port/channel. The overlay button (top) with the border typical is set to momentary feedback and the second button that has the 2 states for text, icon and/or color change set to channel feedback.
  • Spire_JeffSpire_Jeff Posts: 1,917
    If you are simply dealing with a button that only has two states and when they push the button, you want the momentary feedback to be opposite the current state, you could simply put this command into the button event:
    button_event[dvTP,btns]{
        push:{
            [button.input.device,button.input.channel] = ![button.input.device,button.input.channel];
            ///do other stuff here.
        }
        release:{//This may not be necessary, but it will complete the momentary feel. 
            [button.input.device,button.input.channel] = ![button.input.device,button.input.channel];
        }
    }
    

    If you expect the state of the button to update while the client is pushing the button, remove the release portion.

    Jeff
Sign In or Register to comment.