Managing Feedback - Lighting System
alexsquared
Posts: 166
Thankfully, AMX has just released the updated version of the Vantage Infusion module. This module now allows for Feedback based on button LED state. The command string will come in as (KEYPADSYSTEMBUTTONSTATUS-<address>,<status>) So for button with VID 233, it would report as KEYPADSYSTEMBUTTONSTATUS-233,ON if the button was on. Very straightforward. I have implemented the original module numerous times and it works fine. Now, my only question is with regards to the feedback. What would be the easiest way to manage the feedback. If create a new port on my TP for the lighting system, and then assign the button channels and addresses to match the VID #'s, will that automatically pass it through? If not, do I need to monitor a data event and do a find string for KEYPADSYSTEMBUTTONSTATUS? How would you guru's make this work? Keep in mind, that I'm only through Programmer I, so passing things into arrays, structures is still beyond me unless I can get some sample code. With the vantage Qlink System, I did a data event and based on data.text I would send a an on/off state to the button channel.
example:
This was easy with a small system, but I don't want to have a multitude of If statements in a data_event to do this on a larger system.
Thanks for any help?
example:
data_event[vVANTAGE] { string: { nVANTAGE_FEEDBACK = DATA.TEXT IF (data.text == 'K:L:[1:68]:5:1')//liv room { ON [dvTP_VANTAGE, 101] } IF (data.text == 'K:L:[1:68]:5:0') { OFF [dvTP_VANTAGE, 101] } IF (data.text == 'K:L:[1:67]:5:1')//kitchen { ON [dvTP_VANTAGE, 102] } IF (data.text == 'K:L:[1:67]:5:0') { OFF [dvTP_VANTAGE, 102] } if (data.text == 'K:L:[1:68]:2:1')//kitchen dim { ON [dvTP_VANTAGE, 103] } IF (data.text == 'K:L:[1:68]:2:0') { OFF [dvTP_VANTAGE, 103] } IF (data.text == 'K:L:[1:65]:3:1')//master bedroom { ON [dvTP_VANTAGE, 104] } IF (data.text == 'K:L:[1:65]:3:0') { OFF [dvTP_VANTAGE, 104] } IF (data.text == 'K:L:[1:66]:6:1')//master bedroom DIM { ON [dvTP_VANTAGE, 105] } IF (data.text == 'K:L:[1:66]:6:0') { OFF [dvTP_VANTAGE, 105] } IF (data.text == 'K:L:[1:68]:6:1')//OFFICE NURSERY { ON [dvTP_VANTAGE, 106] } IF (data.text == 'K:L:[1:68]:6:0') { OFF [dvTP_VANTAGE, 106] } IF (data.text == 'K:L:[1:67]:2:1')//OFFICE NURSERY DIM { ON [dvTP_VANTAGE, 107] } IF (data.text == 'K:L:[1:67]:2:0') { OFF [dvTP_VANTAGE, 107] } IF (data.text == 'K:L:[1:67]:3:1')//OFFICE NURSERY LAMP { ON [dvTP_VANTAGE, 108] } IF (data.text == 'K:L:[1:67]:3:0') { OFF [dvTP_VANTAGE, 108] } IF (data.text == 'K:L:[1:68]:3:1')//CHINA HUTCH { ON [dvTP_VANTAGE, 109] } IF (data.text == 'K:L:[1:68]:3:0') { OFF [dvTP_VANTAGE, 109] } IF (data.text == 'K:L:[1:66]:5:1')//GARAGE { ON [dvTP_VANTAGE, 110] } IF (data.text == 'K:L:[1:66]:5:0') { OFF [dvTP_VANTAGE, 110] } IF (data.text == 'K:L:[1:65]:7:1')//GOODBYE { ON [dvTP_VANTAGE, 112] } IF (data.text == 'K:L:[1:65]:7:0') { OFF [dvTP_VANTAGE, 112] } } }
This was easy with a small system, but I don't want to have a multitude of If statements in a data_event to do this on a larger system.
Thanks for any help?
0
Comments
Hope this helps,
Jeff
He could of course just have an array of the maximum lighting channel numbers defined even if he doesn't use them all (i.e. nLIGHTING_BTNS[] = {101 - 201} and still approach it mathematically (which I would actually probably do), this way if the client decides to add more lights, there's no coding that needs to be changed, but just a TP change.
I'm starting to do this more and more (define much more than needed) in the event of adding another cable box, DVD, iPod, etc. to choose from and it's worked nicely so far. Many ways to skin a cat.
If so, when the button is pushed off and the code comes through as saying 233,OFF, will it automatically change the sate of the button, or do I need to do If statements setting the channel on if I get an on response and off if I get an off response? This is ultimately the step I would like to condense in code instead of having two if commands for every button.
This might work better...
Dumb question, but will this place the ON, prior to the 233? If so, will that cause any problems?
Thanks.
This was tremendously helpful. Thank you!
I think I got carried away with the example it probably wouldn't work with obvious modifcation for real vantage strings but it show another way to skin the can.
Like I said I got a little carried away and needed a change from what I was doing. Hope this gives you some ideas!
PS some of the initalization values assigned were just to see something other than zero. The Init intialization would normally be 0 but I can't see if it works so I fudged it for testing.
I've never seen a nested for loop 4 levels deep before, except maybe in chess software. Its something to behold.
Paul
I'm open to sugesstions for alternatives. Keep in mind this only runs once when a new TP comes "on page" so to me in my simple mind this mehod makes perfect sense. How would you go about writing code for a device that uses this type of addressing scheme.
BTW, I'm totally in favor of all forum member sharing their code since it can only improve AMX by improving their dealers so let us see how in your mind it should be done. Then maybe someone else will post a different idea and we'll all benefit.
FYI, it's my company so my time is "my time" and I don't pay myself for writing code. I only get paid when there's a profit after the job is complete.
NUM_PROCESSORS = 5
NUM_LINKS_PER_PROC = 20
NUM_KEYPADS_PER_LINK = 256
NUM_BTNS_PER_KEYPAD = 16
then it runs 409,600 times. It'll get slow fast. I generally do lazy panel updating, meaning I never update the panel unless I absolutely have to, ie: feedback has changed, and the user is looking at it right now. In the case of a panel coming online, I'll only update whatever's on the page they will see once online. One of the rare occasions when my natural laziness has side benefits.
Paul
Ok, so I've been working with AMX directly on this, and one of the tech guys was kind enough to send me an AXS file to do what I'm wanting to do. The only caveat is that you set it up so that the button #'s on the TP, match your VID (Button address) on vantage. The control of the vantage system is working just fine. The feedback, however, is not. I verified with my guy that it needs to match the channel code of the button. Any thoughts, looking into this code, as to what may be causing that?