Function variable not working in waits..
shr00m-dew
Posts: 394
So I'm having an issue with my online events for my touchpanels.
I always stack my TP online events and use DATA.DEVICE, or DATA.DEVICE.NUMBER to send all updates and flags to them. In this job we're using an Autonomic Mirage media server that has a UI module for each TP. In order to make sure the UI module will work correctly, I have to connect to the server, send a few commands, then close the connection when each TP comes online.
That involves three waits: wait to make sure TP is connected then connect to server, wait for connection to be established and then send my commands, and then wait for the replies and close the connection.
So, if the tp's came up one at a time, DATA.DEVICE works fine. During a reboot when they all come up about the same time, it seems that DATA.DEVICE is only the latest one that comes up in the stack. IE, some commands go out correctly, some go out twice to the same device, and usually only the last TP online gets everything.
So I put everything into a function and on the online event I did a "TP_ONLINE(DATA.DEVICE.NUMBER)"
Same results. It seems that as the function gets called over and over, the reference variable changes. I was under the impression that calling a function with waits blocked that code out and calling the same function again before the wait expired would block another set of functions out. I guess not.
If a function variable is passed by reference will "FUNCTION(REFERENCE)" change as often as the REFERENCE changes?
I'll try the function call with a index of the TP. FUNCTION(1) should always be different then FUNCTION(2) right?
Kevin D.
I always stack my TP online events and use DATA.DEVICE, or DATA.DEVICE.NUMBER to send all updates and flags to them. In this job we're using an Autonomic Mirage media server that has a UI module for each TP. In order to make sure the UI module will work correctly, I have to connect to the server, send a few commands, then close the connection when each TP comes online.
That involves three waits: wait to make sure TP is connected then connect to server, wait for connection to be established and then send my commands, and then wait for the replies and close the connection.
So, if the tp's came up one at a time, DATA.DEVICE works fine. During a reboot when they all come up about the same time, it seems that DATA.DEVICE is only the latest one that comes up in the stack. IE, some commands go out correctly, some go out twice to the same device, and usually only the last TP online gets everything.
So I put everything into a function and on the online event I did a "TP_ONLINE(DATA.DEVICE.NUMBER)"
Same results. It seems that as the function gets called over and over, the reference variable changes. I was under the impression that calling a function with waits blocked that code out and calling the same function again before the wait expired would block another set of functions out. I guess not.
If a function variable is passed by reference will "FUNCTION(REFERENCE)" change as often as the REFERENCE changes?
I'll try the function call with a index of the TP. FUNCTION(1) should always be different then FUNCTION(2) right?
Kevin D.
0
Comments
TP_ONLINE(DATA.DEVICE.NUMBER+0)
Didn't work.
And even
Didn't work either.
The only thing that has worked is a seperate DATA_EVENT and code for each TP.
Kevin D.
If you want to trigger by the data.event online handler then I would probably create waits for each TP and pass the TPs index to the function and then switch case or select active the index with the different waits for each TP.
I think that will do what you need, but I have not checked for temporary lapses in logical thinking, nor temporary lapses in typing ability
Jeff
That probably would have worked. I wound up going with a timeline for every TP, but a stacked set of timeline events. The timeline ID's were the TP numbers, and commands sent to the TP's were based off of timeline.id.
When the panel is online, set the variable based on get_last() to a value, and start your wait. When your wait expires, have it loop / iterate through your variable and for each one it finds set to your value, perform the appropriate action, then clear the variable.
To quickly modify an above example:
Of course, this starts the wait after the first touchpanel. Is there a real reason / need for the wait?
Reason for the waits is I don't want to rewrite the Autonomics module more than I already have. Using their module you can't discretely select a zone to control without first asking for available zones. That involves:
Connecting the UI module to the server
Wait for module to connect and be ready
Pretend you're someone hitting the zone button to get a listing of zones
Wait for the zone listing to return
Disconnect the UI module from the server to kill unneeded traffic.
It wouldn't be too hard to modify the module to hard code the zone names, but the end user easily has the ability to change those.
Kevin D.
That company is going to hate me eventually.
The well known issues with not declaring huge variables as volatile is easy to fix. The use of slots for bitmaps I dealt with. The fact that it uses port zero for all keyboard functions wasn't hard to overcome (hence the string to string command).
The biggest issue was that the 2.3 module on their website is for the media server software they sell and not for the Mirage stand-alone unit. It works great out of the box, good enough for us to spec it in a couple of jobs. It's when you get to the little details that things started falling apart.
I got "that's addressed in our next module, coming out in two weeks". I started to feel like the money pit, every thing was coming in two weeks. I finally asked if I just need to rewrite the whole module, and that's when I was told the Mirage firmware didn't support everything the server software did and that a new firmware was needed in addition to the new module. That finally came two months after installation.
So at this point I wish it used array's instead of having two modules for every TP in the system, but it works. The only issue left is deleting saved playlists. That command hasn't been implemented yet and I'm stuck with three 'TEST' playlists I created working through the modules. I'm promised that's coming in two weeks..
If anyone wants my modified 2.4 module, I'll send it. 2.3 is still the latest on the site. I need to comment my changes (and send it back to them), but it's better then what comes from the website. It really need to be half the price and have some form of direct OSD control of one zone (that's coming in two weeks as well), but it does a lot of cool stuff as it is right now.
Biggest changes are better memory management, truly working favorites (with option to delete(2.4 supported modules, but they didn't test it. At least 2.4 gave me the right commmands to make it work)), search for anything (not just the exact starting chars), better 'back' support, fixed the page +/- errors, and buttons to get available zones and then select a specific zone.
The module is open source luckily, just so full of functions it's hard to follow what is going on. I would love for you to rewrite it, but the latest protocol document is for the server software and from 2007.....
Kevin D.