TP button feedback, behaving weird
John Paul
Posts: 143
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
}
}
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
}
}
0
Comments
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.
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)
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.
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
Defaults: If you need channels above 255, 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.. 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.
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
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.
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.
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
John_Paul wrote: 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: