Home AMX User Forum AMX General Discussion

Can't get button feedback to work

Guys I need some help.

Problem: I'm not parsing the projector message to get the power button feedback to work. Actually buttons do function but feedback is not changing, only stays in the off position. Below is a txt copy of code can some tell what's wrong..

Thanks

Brian

Comments

  • ericmedleyericmedley Posts: 4,177
    Kouya wrote: »
    Guys I need some help.

    Problem: I'm not parsing the projector message to get the power button feedback to work. Actually buttons do function but feedback is not changing, only stays in the off position. Below is a txt copy of code can some tell what's wrong..

    Thanks

    Brian

    A couple things. First one I'm not sure about. I think the DEFINE_COMBINE statment needs to happen in the DEFINE_START section. I could be wrong about that. Also, I don't think the last comma is needed or will work.

    secondly and more importantly, I'm not sure why you're using the DEFINE_COMBINE statement at all. typically it is used to to combine more than one device (namely touch panels) However, you have only one touch panel in your program. So, there's really nothing to combine. There's really no benefit to doing this in this case that I can see.

    So, if it were me, I'd ditch the whole combine_device thing and just speak directly to the touch panel.

    Now, if you're trying to make your program more flexible and able to communicate to more than one panel at a time, I'd recommend you look at a device array instead. It has a lot more flexibility and gives you a whole host of information about the devices that you cannot get from a combined device.

    here's an example.
    define_device
    dvTP_1 = 10001:01:0
    dvTP_2 = 10002:01:0
    dvTP_3 = 10003:01:0
    
    define_variable
    
    volatile DEV dev_TPs[]=
    {
    dvTP_1,
    dvTP_2,
    dvTP_3
    }
    
    
    button_event[dev_TPs,1]
    {
    push:
      {
      // a button 1 press from any of the three panels
      // button.input.device.number = the device number of which panel did the press ex: 10001 if tp 1 did the push
      }
    }
    
    
    BUTTON_EVENT[dvTP_2,2]
    {
    PUSH:
      {
      // this still works and only one of the TPs will trigger this event.
      }
    }
    
    send_command dev_TPs,'some command' // sends this command to all three TPs
    
    send_command dvTP_3, 'some command' // only sends to TP3
    
    on[dev_TPs,101] // turns on all button 101s on all three tps
    
    etc..
    


    If you look in the help file you can get a whole list of event handlers that will give you a whole raft of info that is useful.
  • I am sure you checked that first, but I had a similar thing and it proved to be a mistake in the panel design. The button was set on "momentary" instead of "channel".

    Of course, as a real programmer, I tackled the problem at its hardest for about half an hour, tracing strings and vars and lines of code before it struck me.
  • KouyaKouya Posts: 60
    Thanks

    Eric, I'm rethinking the Dev combine bit. There was a mvp7500 that was removed from the system.


    Felixmoldovan....guess what! I didn't have a Border name for my Off state, So the only state the border stayed in was the On state which did have a Border name. Duh hence the reason the border didn't change. I should have caught it in button view. Man that won't get me again.

    When I get back to the system I'll report back on the results

    Thanks Guys

    Brian
  • Joe HebertJoe Hebert Posts: 2,159
    Kouya wrote: »
    Problem: I'm not parsing the projector message to get the power button feedback to work.
    If this is the data you are getting back:

    Line 44 (08:34:57):: String From [5001:1:1]-[%001 POWR 000000$0D$0D$0A]

    then the line

    IF(FIND_STRING(PROJ_BUF,"'POWR ',$0D",1))

    will never be satisfied because there is data (000000) between POWR and $OD which means your PROJ_PWR variable will never get twiddled

    You probably want this instead:

    IF(FIND_STRING(PROJ_BUF,"'POWR '",1))

    Also these two lines in define program:
    SEND_COMMAND vdvTP,"'TEXT1-',PROJ_HOURS"
    SEND_COMMAND vdvTP,"'TEXT2-',PROJ_TEMP"

    should be wrapped inside of a WAIT or put in a TIMELINE.
  • DHawthorneDHawthorne Posts: 4,584
    I've had feedback weirdness in the past with combined panels where the only thing that made a difference was the combine ... get rid of it and everything worked as expected. I now strictly use panel arrays and a FOR loop for my feedback.
  • remeolbremeolb Posts: 79
    DHawthorne wrote: »
    I've had feedback weirdness in the past with combined panels where the only thing that made a difference was the combine ... get rid of it and everything worked as expected. I now strictly use panel arrays and a FOR loop for my feedback.

    Please elaborate. I'm having issues with feedback on multiple panels right now.
  • DHawthorneDHawthorne Posts: 4,584
    DEFINE CONSTANTS
    
    NUMBER_PANELS = 2
    
    DEFINE_VARIABLES
    
    DEFINE DEV dvPanels[] = {dvPanel1, dvPanel2}
    
    DEFINE_FUNCTION CHAR fnFeedback()
    {
        STACK_VAR CHAR nCount
    
        FOR(nCount =1; nCount <= NUMBER_PANELS; nCount ++)
        {
        /// update panel here
        }
    }
    
  • KouyaKouya Posts: 60
    Guys,

    I noticed I never reported back on this original post. I did get this system working correctly, Jon hit it right I was pasing Left_string when is should have been Right Also I noticed that had I properly managed the data from the projector either method would have worked

    Sorry for late report seeing it on the list jogged the old memory bank

    Thanks

    Brian
Sign In or Register to comment.