Can a device only have one buffer message?
mjones2620
Posts: 86
Trying to read/write to a file for names & numbers. I have tried creating a buffer which didn't work, and data.text clears out other messages as they come in. Never the less, this doesn't work:
How can I hold a value in one buffer without clearing the other? Is this possible?
BUTTON_EVENT[dcNAMES] { PUSH: { nCURRENT_NAME = GET_LAST(dcNAMES) TO[BUTTON.INPUT] } HOLD[20]: { SEND_COMMAND dvTP,"'@AKB-',uPRESETS[nCURRENT_NAME].cNAMES" } RELEASE: { WAIT_UNTIL(nDONE) { uPRESETS[nCURRENT_NAME].cNAMES = cDATA SEND_COMMAND dvTP_VTC,"'^TXT-',ITOA(nCURRENT_NAME + 499),',0,',uPRESETS[nCURRENT_NAME].cNAMES" fnWRITE_FILE('VTC Presets.csv') } } } BUTTON_EVENT[dcNUMBERS] { PUSH: { nCURRENT_NUM = GET_LAST(dcNUMBERS) TO[BUTTON.INPUT] } HOLD[20]: { SEND_COMMAND dvTP,"'@AKP-',ITOA(uPRESETS[nCURRENT_NUM].nNUMBERS)" } RELEASE: { WAIT_UNTIL(nDONE) { uPRESETS[nCURRENT_NUM].nNUMBERS = nDATA SEND_COMMAND dvTP_VTC, "'^TXT-',ITOA(nCURRENT_NUM + 603),',0,',uPRESETS[nCURRENT_NUM].nNUMBERS" fnWRITE_FILE('VTC Presets.csv') } } }
How can I hold a value in one buffer without clearing the other? Is this possible?
0
Comments
Paul
Ahhh, this worked. THANKS!
I'm parsing the message in the keyboard/keypad and I don't want it to write to file until after the message is parsed. Putting the Get_last in my release statement worked.
This was code tweaked from my P2 class... they tought us WAIT_UNTIL. I kind of like it.
I would agree with a_riot42. If you are parsing for a data string from a UI upon keypad/keyboard entry, I'd probably initiate it in the data_event and then call a function. For example: what happens if the user hits abort on the keypad? Or the panel goes offline? Stuff like that...
I'm glad the fix worked.
If user hits abort I am using the CANCEL_ALL_WAITS function.
I wouldn't recommend that. What if you need a wait elsewhere that shouldn't be affected? And what if one gets added 6 months from now, and you forget the cancel_all is in there?
Cancel_all_waits and wait_until should be forgotten and never used. As soon as you think you need them to make something work you should throw out what you've written, get a good night's sleep and start from scratch in the morning.