Resending level events on touchpanel reboot?
vegastech
Posts: 369
I'm sure I've done this before, but it's been a while, so here goes:
I have a loop that sends multiple level events to my touchpanel each time a change is sent to my autopatch switcher:
I have a loop that sends multiple level events to my touchpanel each time a change is sent to my autopatch switcher:
DATA_EVENT[AUTOPATCH] { ONLINE: { SEND_COMMAND AUTOPATCH, "'SET BAUD 9600,N,8,1'" } STRING: { local_var char APResponse [50] local_var integer APSource local_var char APRooms [15] //15 possible rooms local_var char dump[20] local_var integer input [10] local_var integer i APResponse = data.text IF(FIND_STRING(APResponse,'T',1)) //CL1I5O1 2 3T { REMOVE_STRING(APResponse,'I',1) //deletes CL1I //leaves APResponse with O1 2 3T APSource = ATOI(LEFT_STRING(APResponse,1)) //copied the I5. //APSource converted the I5 into just 5. //APResponse now needs the outputs put into an array. dump = REMOVE_STRING(APResponse,'O',1) //takes the O out. //this leaves 1 2 3T as the remaining string, APResponse. APResponse = LEFT_STRING(APResponse,LENGTH_STRING(APResponse)-1) //removes T APResponse = "APResponse,' '" //adds a space at the end //got rid of the T, leaves just the #s FOR(i=1;i<=9;i++) { input[i] = ATOI(REMOVE_STRING(APResponse,' ',1)) CurrentSource[input[i]] = APSource //SEND_COMMAND dvTP1, "'^TXT-',itoa(i),',',itoa(CurrentSource[i])" SEND_LEVEL dvTP1,i,CurrentSource[i] } } } }At this point, whenever my touchpanel reboots, the level_event changes are lost. I understand that they all get set back to nothing on a reboot. How can I re-send the loop on reboot, without a command being sent to the switcher? I was thinking that perhaps I needed to set up an array to retain the info pulled from the string event, and then call it in the online event for the panel. Am I on the right track here?
0
Comments
More to your point, I alway store values to refresh when I go "on a page" but if I'm not "on a page" I simply store values and if I'm "on page" I store for other TPs that might not be on page and I also directly update the current page. So if you store your values you can easily refresh for what ever method you choose to manage your feedback and it save you the need to re-poll the devices to refresh a TP that was rebooted.
In most cases I prefer to update as the data comes in, one value at a time. I store and I send. I'll also have a function to refresh or update the entire page for occurrances like the original post wanted where you need to bring the enite page up to date when going onto the page or refreshing after a reboot. If a single bit of data comes in I'll just send that data and not call a function that refreshes everything when only one values has changed. Some devices vary so if I just make a switch between an in and an out do I really need to update all the ins and outs that haven't changed?
For my switchers I always create a structure array for the rooms/outputs so that it's easy to store the information as it's updated and resend to the panels when needed.
--John