One more question, if I may
My AY-AT seems to have a pretty bad encoder and I have problems getting double clicks to be recognized. I will replace it, but right now I don't have one handy. I'd like to lengthen the time for a double click, so that it's not such a hit or miss affair.
I looked at user.c, the TestKey function. In the following snippet:
/* determine key press type */
if (Ticks > 26) /* long (>= 300ms) */
{
Key = KEY_LONG; /* signal long key press */
}
else /* short (< 300ms) */
{
Key = KEY_SHORT; /* signal short key press */
/* check for second key press if requested */
if (Mode & CHECK_KEY_TWICE)
{
MilliSleep(50); /* delay for checking key again */
Ticks = 20; /* timeout of 200ms */
while (Ticks > 0) /* timeout loop */
{
Test = BUTTON_PIN & (1 << TEST_BUTTON); /* get button status */
if (Test == 0) /* test button pressed */
{
MilliSleep(30); /* time to debounce */
Test = BUTTON_PIN & (1 << TEST_BUTTON); /* get button status */
if (Test == 0) /* test button still pressed */
{
Ticks = 1; /* end loop */
Key = KEY_TWICE; /* signal two key presses */
MilliSleep(200); /* smooth UI */
}
}
Ticks--; /* decrease timeout */
MilliSleep(10); /* wait 10ms */
}
}
I think that if I change if (Ticks > 26) /* long (>= 300ms) */
to a value higher than 26, say 35, I should get a longer timeout for a long press to be recognized, and Ticks = 20; /* timeout of 200ms */
while (Ticks > 0) /* timeout loop */
to 25, that should give me more time to have a double click recognized.
@madires can you please let me know if I'm on the right path? It's rather inconvenient for me to remove the Atmega328p to program it and reinstall, so I'd like to minimize the amount of modify/compile/flash, if you have time to chime in. If not, I'll try it out