Home AMX User Forum AMXForums Archive Threads Tips and Tricks

TP button feedback, behaving weird

I have a situation where i have touch panel which has four buttons and based on which buttons is pushed, the rest of the three buttons is turned off and the selected button is set to on. I have posted the code for this here but the feedback is behaving weird. If i reboot the controller, the code doesnt seem to work for some time and then it starts showing again. Is it because i am using viritual touch panel or ??

DEFINE_VARIABLE
integer nFloorLEDbuttons[] =
{
351, //2nd
352, //1st
353, //Gnd
354 //Basement
}
DEFINE_MUTUALLY_EXCLUSIVE

define_combine
(virtualTPMBRAutonomicsSwt,dvTPR4MBRAutonomicsSwt,dvTpMBR3AutonomicsSwt,dvTpMBR2AutonomicsSwt,dvTpMBR1AutonomicsSwt,dvTpMBRAutonomicsSwt52,dvTpMBRAutonomicsSwt10,dvTPDRMAutonomicsSwt)

DEFINE_MUTUALLY_EXCLUSIVE

([virtualTPMBRAutonomicsSwt,351].. [virtualTPMBRAutonomicsSwt,354])

BUTTON_EVENT[virtualTPMBRAutonomicsSwt,nFloorLEDbuttons]
{
PUSH:
{
[virtualTPMBRAutonomicsSwt,nFloorLEDbuttons[GET_LAST(nFloorLEDbuttons)]]=1

}
}

Comments

  • ericmedleyericmedley Posts: 4,177
    John Paul wrote: »
    I have a situation where i have touch panel which has four buttons and based on which buttons is pushed, the rest of the three buttons is turned off and the selected button is set to on. I have posted the code for this here but the feedback is behaving weird. If i reboot the controller, the code doesnt seem to work for some time and then it starts showing again. Is it because i am using viritual touch panel or ??

    DEFINE_VARIABLE
    integer nFloorLEDbuttons[] =
    {
    351, //2nd
    352, //1st
    353, //Gnd
    354 //Basement
    }
    DEFINE_MUTUALLY_EXCLUSIVE

    define_combine
    (virtualTPMBRAutonomicsSwt,dvTPR4MBRAutonomicsSwt,dvTpMBR3AutonomicsSwt,dvTpMBR2AutonomicsSwt,dvTpMBR1AutonomicsSwt,dvTpMBRAutonomicsSwt52,dvTpMBRAutonomicsSwt10,dvTPDRMAutonomicsSwt)

    DEFINE_MUTUALLY_EXCLUSIVE

    ([virtualTPMBRAutonomicsSwt,351].. [virtualTPMBRAutonomicsSwt,354])

    BUTTON_EVENT[virtualTPMBRAutonomicsSwt,nFloorLEDbuttons]
    {
    PUSH:
    {
    [virtualTPMBRAutonomicsSwt,nFloorLEDbuttons[GET_LAST(nFloorLEDbuttons)]]=1

    }
    }

    I don't see anything that stands out. However, you didn't post all your device declarations.

    There is some known flakiness that can happen when combining devices if one or more of the devices in the combine goes offline.

    You might consider using a DEV array instead of combining devices. There is almost nothing you can't do and it is way more flexible. I honestly cannot think of any reason to use the COMBINE over a DEV array.

    Just a thought.
  • I have written the part i left out in the mail here. Also this is the tango audio controller which is residing in another master and i am controlling using a duet module for this purpose. I somehow dont get feedback for this device also, then after some time i start getting it


    DEFINE_DEVICE

    //Autonomics Switching
    dvTpMBRAutonomicsSwt52=10014:42:4//for 5.2" touch panel
    dvTpMBRAutonomicsSwt10= 10015:42:4//for 10" TP
    dvTpMBR1AutonomicsSwt=10016:42:4//for 5.2" touch panel
    dvTpMBR2AutonomicsSwt= 10017:42:4//for 10" TP
    dvTpMBR3AutonomicsSwt= 10018:42:4//for 10" TP
    dvTPR4MBRAutonomicsSwt = 10019:42:4
    dvTPDRMAutonomicsSwt = 10020:42:4

    //Autonomics Switching

    virtualTPMBRAutonomicsSwt= 34001:1:4

    define_combine
    (virtualTPMBRAutonomicsSwt,dvTPR4MBRAutonomicsSwt,dvTpMBR3AutonomicsSwt,dvTpMBR2AutonomicsSwt,dvTpMBR1AutonomicsSwt,dvTpMBRAutonomicsSwt52,dvTpMBRAutonomicsSwt10,dvTPDRMAutonomicsSwt)
  • ericmedleyericmedley Posts: 4,177
    Well, if there's master-to-master communication between combined devices, I can see where there might be some flakiness when it comes to feedback and whatnot.

    I would definitely recommend going with the DEV array, then.
  • HedbergHedberg Posts: 671
    ericmedley wrote: »
    I would definitely recommend going with the DEV array, then.

    Way back in 2003 when I did the programming courses, we were taught how to use the combine device thing but that seemed to be a hold over from the Axcess days -- the prevailing sentiment, even back then, was that using arrays was cleaner, easier to implement, and easier to manage. The last time I attended an AMX class (RMS last year) I had a short discussion with the instructor about this and his feeling was that except in the very rare circumstance when you might want to combine and uncombine that there was no reason to combine rather than to use arrays. Personally, I've never installed a commercial program that used device combining.
  • Virtual TPs vs DEV array

    Since i have more than 6 controllers per controller and since this is a tango audio controller, i had used virtual tps. Since there are level events in the touch panel, if i use a DEV array, when the touch panel goes offline, the volume,etc goes to zero which was disturbing. So i combined the tps in a virtual tp .


    Now i am thinking that for the feedback section, i will use a dev array and the levels part, i will use the virtual tps in combine mode. Do you think this is a proper way to go about it
  • viningvining Posts: 4,368
    Since your using virtuals you should consider some of the default limitations that virtuals have and make sure they aren't part of your problems.

    Defaults:
    By default every virtual device port maintains the state of channels 1-255 inclusive.
    If you need channels above 255,
    Example:
    
    SET_VIRTUAL_CHANNEL_COUNT (dvVirtual,1024) // 1024 channels
    
    By default every virtual device maintains the state of a single port (port 1).
    So if you use 33001:1:0, 33001:2:0,3300:3:0, you may need to set you port count. Some times they work if you declare them but sometimes they don't so I tend to play it safe and..
    Example:
    
    SET_VIRTUAL_PORT_COUNT (dvVirtual,2) // 2 ports
    
    By default every virtual device port maintains the state of levels 1-8 inclusive.
    Example:
    
    SET_VIRTUAL_LEVEL_COUNT (dvVirtual,10) // make it have 10 levels
    
    levels actually come in blocks of 8 so if you ask for 10 you'll get 16. Channels are probably in block of 256 but that doesn't really matter, just ask for what you want but don't be suprised if you get more than you asked for.

    As far as combining, I personally don't combine anything but since you're sending to virtuals combining to real TP would be ok. I think there are cleaner approaches if you're just trying to avoid send levels when the TP go offline and just require a "push" to be in affect while accepting TP level changes.

    Create a var to and set it when the bargraph is pushed, clear it upon release, then use this var in your level event to qualify the level coming from the TP. Yuri has suggested this many times here on the forum and it's very simple to do.
  • i put the this SET_VIRTUAL_CHANNEL_COUNT (dvVirtual,1024) // 1024 channels under the Define_Start

    is there any other place i shud put it. Now i understand why i was not getting feedback, all my virtual tps channel no were after 255 and some how the commands were going and feedback used to come after an hour or so
  • viningvining Posts: 4,368
    You have multiple masters, then if I recall you need a data event in each master that uses these virtuals.
    Also after you set your new counts you should call REBUILD_EVENT() in each system so it re-builds the event tables associated with these counts.

    I pretty sure this is the correct procedure and how I do it but these areas are a little fuzzy for me since they're not really spelled out in PI or the help files so the majority of my understanding of this comes from the forum and primarily Joe Hebert so if I got this wrong it's his fault. :D
  • viningvining Posts: 4,368
    Oh, I noticed I wasn't clear about the SET_n_COUNTS. They should be in the online event handler for those partcular devices or arrays.

    If in a data event for the entire array which includes real TPs just test for DEV[get_last index of array].NUMBER > 33000, then set counts, rebuild event.
  • I didnt understand your last post. so are you saying that
    DEFINE_START
    SET_VIRTUAL_CHANNEL_COUNT (virtualTPMBRAutonomicsSwt,1024) // 1024 channels
    REBUILD_EVENT()

    is not the right way and it should be in the online event of the virtualtp or this set_n_Count is only for dev array
  • viningvining Posts: 4,368
    Yeah, when define start runs there's a good possiblity that your virtuals won't be online yet and subsequently not receive the command. So if you wait until it comes online to send the command you can ensure the instrunctions are received. Otherwise you're just rolling the dice and taking a chance.

    John_Paul wrote:
    or this set_n_Count is only for dev array
    Yeah I may have muddied the waters with that line.

    I was just saying that if you use a TP DEV array of real & virtual devices you should test each device as it comes online using the get_last function. So when a TP comes online you can test it and see if it's a virtual or not:
    DATA_EVENT     [dvUIArry]// contains real and virtual TP devices
        
        {
         ONLINE:
    	  {
    	  STACK_VAR INTEGER nUI_Indx ;
    	  
    	  nUI_Indx = GET_LAST(dvUIArry) ;
    	  if(dvUIArry[nUI_Indx].NUMBER >= 33000)
    	       {
    	       SET_VIRTUAL_CHANNEL_COUNT (dvUIArry[nUI_Indx],1024) ;
    	       REBUILD_EVENT() ;
    	       }
    	  }
         }
    
  • Thanks VAV for all the help, its working now
  • This post helped me out also, thanks.
Sign In or Register to comment.