TP_ARRAY vs DEFINE_COMBINE
dthorson
Posts: 103
What?s the dis/advantages of using a TP_ARRAY[] vs DEFINE_COMBINE a panel and a virtual panel?
DEFINE_DEVICE dvTP = 10001:1:0 (* MVP-8400 Modero ViewPoint Touch Panel *) vdvTP = 33001:1:0 (* VIRTUAL TOUCH PANEL DEVICE *) DEFINE_COMBINE (vdvTP,dvTP) //-------------------- OR --------------------// DEFINE_VARIABLE DEV TPArray[] = {vdvTP, dvTP}
0
Comments
I use combine devices this way because you can UNCOMBINE_DEVICES anywhere in programming and then recombine it again. (Great for combinable conference rooms.) You can't do that with a DEFINE_COMBINE or an array.
However with an array you can always group what ever elements of the array you want and never have to worry about combining or uncombining. Basically what combine devices does is load the DEV values in an empty DEV array or structure, well at least that's want I assume it does.
I almost never use combines anymore, always an array. Combining makes all of your real devices act like a single panel, so if you ever need to know exactly what panel a command came from, you are out of luck. All of your panels have to be doing exactly the same thing at any given instant. And for many modern devices, this cripples the functionality. Take any media server, from iPod to MAX - you really need for each panel to work independently, and combining them makes that impossible. And frankly, I don't see where combining gives you any advantage over an array. If you want all your panels to reflect the same thing all the time, you can just as easily send your updates to the array as to a virtual.
So a DEFINE_COMBINE, all panels act as one.
A TP_ARRAY, you can add or remove panels as needed, and determine what panel triggered an event.
With COMBINE_DEVICES, you can uncombine as needed.
I like that we have this flexibility with AMX.
nBUTTON_ARRAY[]={1,2,3}
ON [dvDEVICE,nBUTTON_ARRAY] will show feedback on all three buttons.
OFF [dvDEVICE,nBUTTON_ARRAY] will NOT always stop feedback on the buttons.
I have pretty much accepted, for myself, that DEV arrays are the way to go. All of the "benefits" of combined devices can be acheived in code within a device array, with a lot more reliability.
Okay, I was going to post a thread about this, but it looks like I can continue here. TurnipTruck, you mentioned above that COMBINE_DEVICES gives you strange feedback, but your example shows an array.
My issue is when I do an array of panels, I can capture the pushes, but if I try to send feedback to the array, it doesn't work.
Example
I've also tried it by sticking virtual devices in there, but the result is always the same. No feedback when sent to a device array.
Am I doing something wrong or is this how it works?
Thanks!
Joe
How about
You will also need to define POWER_ON as some sort of an integer variable.
I disagree with this. Even in systems with one panel I use a DEV array for that panel, the reason being that I can then add another control device (like a keypad or handheld) without changing too much code.
I see the point, but I also tend to want to conserve resources (a bit old-school, I guess ... not working with 64K anymore, I have to keep telling myself ...). I find it trivial to change a single panel reference to an array reference if I am upgrading. And besides, I did say there was no reason for an array on a single device, and IMO, prepping for potential multiples is not really a "single" device anymore.
Joe,
I do exactly this in most programs I write, and I've never had a problem with feedback to the array.
--D
[TP_ALL,1] = POWER_ON=1 // THIS DOESN'T WORK
How about :
[TP_ALL,1] = (POWER_ON=1)
I did this more than once without problems.
Richard
[TP_ALL,1] = POWER_ON
There's no need to add anything else on top of that...
- Chip
But if it means anything, yes - I'm currently ranked as a Commander Grade 1 in matchmaking.
- Chip
What does [TP_ALL,1] = POWER_ON=1 give you that [TP_ALL,1] = POWER_ON doesn't?
Its similar to:
The line
[TP_ALL,1] = (POWER_ON=1)
will turn the feedback on if and only if POWER_ON equals 1.
The line
[TP_ALL,1] = POWER_ON
will turn the feedback on if POWER_ON equals anything other than 0 (e.g. 2).
I follow the latter style unless I explicitly need the former.
I understand the difference, I guess I just wonder why you would want to break a decades old convention. To my thinking POWER_ON can only have two states, on or not on, and thus could never be equal to anything other than 0 or 1 (or some other positive integer).
0=off 1=on 2=cooling/warming, this way I can change the button states and block out any pressing when in a cool/warm state.
If it is a small job with only one panel, I'll use some DEFINE_PROGRAM feedback, otherwise I always do feedback on the string return of an ONLINE device.
Sure I do that too, but then I would have a variable named POWER or PROJ_STATUS that can have say an ON, OFF and STANDBY state. But I would never have a variable named POWER_ON that has more than two states. That's just confusing to me.
Paul
When the door is opened, I need to have both panels mimic each other - on a page showing the combined facilities (ie both screens, projectors, volume etc)
Woud this work...
when the rooms are separate, both panels are independant
when the rooms are open, create a page that offers all the facilities (screens, proj, volume) for both rooms and combine the panels when this page is being used.
When the rooms are separated again, uncombine them.
Thoughts?