Time - Accuracy beyond 1 second??
TrikinCurt
Posts: 158
Okay, I fear I am in trouble but am hoping someone has an answer. I am using some Vantage Infusion keypads to control an AMX system. It is all IP and easy enough, but I would like to be able to tell if the user has "Held" a button. I get PUSH and RELEASE commands back from Vantage.
It seems Netlinx can only be accurate to a second which is a problem for checking if a button is held. For example:
This works for me, but with one second accuracy it really doesn't help. Sometimes you hold the button for under a second, but it isn't the SAME second, and holding the button for a few seconds is just silly.
Anyone had to do something similar?
It seems Netlinx can only be accurate to a second which is a problem for checking if a button is held. For example:
if (dataValue='PRESS') { pressTime = TIME WAIT_UNTIL (dataValue='RELEASE') { releaseTime = TIME SEND_STRING 0,"'PRESS TIME: ',pressTime,' RELEASE TIME: ',releasetime" } }
This works for me, but with one second accuracy it really doesn't help. Sometimes you hold the button for under a second, but it isn't the SAME second, and holding the button for a few seconds is just silly.
Anyone had to do something similar?
0
Comments
SET_TIMER
who knew... still not sure if I can make this work but it is accurate to 1/10 of a second...
- Chip
The Method below requires a TIMELINE_EVENT but like all events they only need be evaluated during the event itself.
So while I could potentially have multiple timelines going (if someone magically pressed every button at once), odds are very few are going at once. If I had to create timeline event handlers for every potential timeline, that would be some crazy code.
With that said, any suggestions to make the above code work without having to wait for the release?
Determine what Vantage can do, can you in fact push multiple buttons at the same time or at least hold one button, then push another and have that second button send a string while the first button is still being pressed. If it does you'll have to assign a different strings for the each of the buttons and in your data_event string handler create a queue to hold these values so they can processed one at a time but that can start getting a little tricky as strings will probably arrive out of sequence. (push_1;push_2;push_3;release_1;push_4;release_2) for example.
The simple solution regardless of what the Vantage does is just allow one event at a time. If the time_line is active disregard everything until the matching release is received which will kill it. Then you're ready for another push.
Are you talking from one keypad at a time or dozens of keypads with all having the potential of being used simultaneously.
If the potential of multiple keypads being I might think about setting up for multiple timelines depending on the likely hood of being used at the same time and create a "roll over" sequence so if TL_1 is active use TL_2 using a SELECT ACTIVE like below where the first available timeline will be used. Out of curiosity what are you actually trying to do with these Vantage buttons any way, audio? I've done that with HomeWorks but never really gave simultaneous usage much thought, maybe I should have but I didn't.
I've never touch Get_Timer so I can't help with that.
In your code example the Timeline_get is only evaluated when the data_event string handler sees "release" so if you keep holding nothing will happen and could get annoying if you keep releasing to soon.
My previous example allow you to evaluate for a hold with out a release.
It the Vantage world every button has a VID and that is what they send data for, not keypads at all. So, in this example I have something like 300 buttons doing various stuff.
Vantage just sends push and release commands and it is certainly possible to push and hold a button, and push/release another while the first is held (even on the same keypad).
The code I am using can handle all of that without anything complicated so it seems that just making it that the hold does not issue until the release is my best route out.
Maybe I will get some time and play with your latest idea later, but I have enough to keep me busy right now!
Thanks for all the help,
Curt