COMBINE_DEVICES and TP Online events
sonny
Posts: 208
Greetings...
I have searched and searched the documentation for this but can't find. I thought I read once where a touch panel would be updated with variable information from the virtual device when a combine is executed...
For example, at some point in time when the device is offline...
SEND_COMMAND vTP, "'^TXT-1,1&2,Somthing New'"
then in the ONLINE event...
COMBINE_DEVICES (vTP, someRealTP)
Channel 1 on the device someRealTP needs to be set to 'Something New', but it doesn't work with this set of commands. I do an UNCOMBINE when the TP goes offline, but functionally there doesn't appear to be any difference.
If this doesn't happen automatically, then I guess I need to write a big update routine to be called when a/the device comes online. Not really inviting meaning I must store real-time values of all data in data structures.
Any ideas??
I have searched and searched the documentation for this but can't find. I thought I read once where a touch panel would be updated with variable information from the virtual device when a combine is executed...
For example, at some point in time when the device is offline...
SEND_COMMAND vTP, "'^TXT-1,1&2,Somthing New'"
then in the ONLINE event...
COMBINE_DEVICES (vTP, someRealTP)
Channel 1 on the device someRealTP needs to be set to 'Something New', but it doesn't work with this set of commands. I do an UNCOMBINE when the TP goes offline, but functionally there doesn't appear to be any difference.
If this doesn't happen automatically, then I guess I need to write a big update routine to be called when a/the device comes online. Not really inviting meaning I must store real-time values of all data in data structures.
Any ideas??
0
Comments
Sonny,
Check out Tech Note 478 - I recall seeing this note a long time ago and it stuck in my mind since it drove how I coded my touchpanel ONLINE handlers for those systems that use variable text on the touchpanels.
As you can see from the note, variable text sent to a panel that is OFFLINE will not be retained/remembered and therefore the variable text information for the panel when it comes ONLINE is not current (assuming vartext was updated while the panel was OFFLINE). When a panel comes ONLINE, only channels and levels are updated - not variable text. The ONLINE handler for the touchpanel is responsible for refreshing any variable text fields on the touchpanel. This is true regardless of whether or not a COMBINE is used for the touchpanel.
I have always coded my TP ONLINE handlers to refresh all variable text information for the panel as a result.
Hope this helps (even though the answer was probably not what you were looking for) .
Reese
Another argument for grouping panels using DEV arrays instead of combines...
- Chip
Chip,
Not sure of the answer regarding your question - I do not use COMBINE devices as I prefer DEV arrays as you suggested so I get the ONLINE and OFFLINE events for all my devices. For touchpanels, this allows me to handle the variable text accordingly. Independent of the COMBINE device portion of the question, I just wanted to confirm what Sonny found out the hard way regarding panels in the offline state with respect to vartext.
Reese
From the vartext perspective, what is your preference for storing data locally? If I need data in a module from a program standpoint I will keep a local copy of it, otherwise I just set the text on the button and move on (guess I need to rethink that practice). I would think writing a refresh routine in the module that "produces" the data would be the most efficient route, then do a "SEND_STRING" or button push to flag the refresh function to run when the panel ONLINE event occurs. I really don't like writing the same piece of data from multiple places...can get messy if you alter the format. I guess one thought would be to create a two-dimensional array where a DEVCHAN and the current text are the entries. Then just run through it in a loop. Although not sure what this would do to performance.
I haven't used a device array as most of my jobs are residential with just a panel or two, and they are usually independant. How do you remove a device from the array, write 0:0:0 to it? Also, assuming your program permits panels to come and go, are you doing array compression...i.e. panel 2 of 5 goes offline, remove 2 and shift down? or do you have a search routine that finds the first open slot to insert a panel coming online?
Again...thanks, Sonny
Sonny,
I can't speak for others but here is what I do in my programs/modules for the two specific cases you noted:
1. Variable Text - I generally write a DEFINE_CALL/DEFINE_FUNCTION which handles all variable text for my touchpanels (one per module). If it is a simple module with a small amount of variable text, the routine will write all variable text fields when called. In more complex modules, I pass flags to the function that tell it which groups of text to write so it is more efficient. In the ONLINE case for a touchpanel, I call the routine to refresh all of the text fields. This of course means that all of the information required for the variable text is maintained in some sort of data structure so it can be reproduced as needed. I have just gotten into a habit of implementing variable text this way. Then, when a touchpanel needs to be updated, I can update it selectively or I can update the entire panel at ONLINE time. Note, since I use modules extensively, each module has an ONLINE handler for a touchpanel and each module is responsible for updating its variable text fields on the TP.
2. Regarding your second question, I wrote a series of routines some take back that will add and delete DEV entries to an array. I use this for device arrays for a variety of purposes. Since my delete routine does compaction (moves all DEVs up in the array to fill empty slots), adding a device is easy since an add always places a DEV at the end of the array and increases the size by 1 entry. I have found that this works well for me.
Reese
I've largely gotten away from the DEVICE_COMBINE thing with modero panels; thge times when this is a convenient way to di it is when dealing with older G3 panels that have far more limited channel and device numbers, necessitating using the same devchans for multiple functions. Sending all the processing through the virtual makes it possible to use the same devchan combinations for multiple devices, since they only act when the COMBINE is active.