Home AMX User Forum NetLinx Studio
Options

"Hold" not letting go

This is a gotcha for people like me who still occasionally come across the really old touchpanels. Trying a bit of test code, I found that it's possible, if you set the HOLD repeat time xx as in "HOLD [xx,REPEAT]:" to 1 (=0.1s), to have it keep on doing this event even after removing the finger off the button. This was a bit of a surprise!

DEFINE_EVENT

Data_event[dvPORT]
{
STRING: //parse string from port, display digits on TP
{
TEMPSTRING = DATA.TEXT
TEMPSTRING = MID_STRING(TEMPSTRING,24,4)
SEND_COMMAND dvTP,"'!T',1,TEMPSTRING"
}

}

BUTTON_EVENT[dvTP,dvBUTS] //ramp digits up or down
{
PUSH:
{
X = GET_LAST(dvBUTS)
}

HOLD [1,REPEAT]:
{
SWITCH (X)
{
CASE 1:
{
TEST++
SEND_STRING dvPORT,"'12345678901234567890123',ITOA(TEST),'XX'"
}

CASE 2:
{
TEST--
SEND_STRING dvPORT,"'12345678901234567890123',ITOA(TEST),'XX'"
}

}
}
}

I'm guessing this is happening because I've made the buss rather busy writing text back to the panel so it never sees the release?? I was using a very old TP (v1.52!). It doesn't do this with a G3 panel. It took me a while to guess it was the old panel causing the problem.

For testing I have the TX and RX of dvPORT tied together. I wanted to test some volume parsing code, which needs to go at this speed. When I made that hold time 2 or more, it worked as expected on the old panel. Actually I had to send the volume "nudge up or down" command, then followed by a status request to find out where it was. I think the receiver couldn't cope at a repeat time of .1s with getting two commands every .1s.

OP

Comments

  • Options
    vincenvincen Posts: 526
    If HOLD stays on all the time it means panel never sends RELEASE. May you change your HOLD to be a RELEASE and check if when you release buttons it happens ? If not it means your panel never releases buttons !! Only way to correct that is to upgrade your panel..

    Vinc
  • Options
    The panel is fine. I use it every day (my own home theater set up). If I increase the repeat time to .2 seconds it's fine too. It's just that at .1s it never sees the release (or any other press for that matter!) Just a quirk of the older firmware I guess

    OP
  • Options
    DHawthorneDHawthorne Posts: 4,584
    You may be loading up the event buffer. When you use the HOLD handler with the repeat option, it queues an event for every iteration of your repeat while the button is held. When you release it, if there are still events in the queue, they keep on triggering until they have all finished. The solution for this is to increase the repeat time. You have to give your device time to process each event before triggering a new one. This is generally a backup in the output device output queue (like the IR port), but I have managed to do it with internal messages like SEND_COMMANDS, etc., as well.

    Also, it is possible that the RELEASE event just isn't making it to the master for some reason. A HOLD is nothing more than a RELEASE after a specific time period following a PUSH. If the PUSH goes through but not the RELEASE, the HOLD is activated and never shuts off. This is common with the older RF Viewpoint panels.

    If your repeated events eventually stop on their own, you have a buffer issue and need to increase the repeat time. If it goes on forever, but stops if you tap the button again, you are sometimes missing the release (in which case, if you can't fix the communications problem, you need to look at another way of doing it).
Sign In or Register to comment.