diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/button.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 1cb9472e0f..c4c22641ca 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -365,6 +365,7 @@ static void button_tick(void) | |||
365 | static int repeat_speed = REPEAT_INTERVAL_START; | 365 | static int repeat_speed = REPEAT_INTERVAL_START; |
366 | static int repeat_count = 0; | 366 | static int repeat_count = 0; |
367 | static bool repeat = false; | 367 | static bool repeat = false; |
368 | static bool post = false; | ||
368 | int diff; | 369 | int diff; |
369 | int btn; | 370 | int btn; |
370 | 371 | ||
@@ -381,7 +382,6 @@ static void button_tick(void) | |||
381 | /* only poll every X ticks */ | 382 | /* only poll every X ticks */ |
382 | if ( ++tick >= POLL_FREQUENCY ) | 383 | if ( ++tick >= POLL_FREQUENCY ) |
383 | { | 384 | { |
384 | bool post = false; | ||
385 | btn = button_read(); | 385 | btn = button_read(); |
386 | 386 | ||
387 | /* Find out if a key has been released */ | 387 | /* Find out if a key has been released */ |
@@ -406,7 +406,8 @@ static void button_tick(void) | |||
406 | { | 406 | { |
407 | if ( repeat ) | 407 | if ( repeat ) |
408 | { | 408 | { |
409 | count--; | 409 | if (!post) |
410 | count--; | ||
410 | if (count == 0) { | 411 | if (count == 0) { |
411 | post = true; | 412 | post = true; |
412 | /* yes we have repeat */ | 413 | /* yes we have repeat */ |
@@ -458,9 +459,18 @@ static void button_tick(void) | |||
458 | if ( post ) | 459 | if ( post ) |
459 | { | 460 | { |
460 | if (repeat) | 461 | if (repeat) |
461 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 462 | { |
463 | if (queue_empty(&button_queue)) | ||
464 | { | ||
465 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
466 | post = false; | ||
467 | } | ||
468 | } | ||
462 | else | 469 | else |
470 | { | ||
463 | queue_post(&button_queue, btn, NULL); | 471 | queue_post(&button_queue, btn, NULL); |
472 | post = false; | ||
473 | } | ||
464 | #ifdef HAVE_REMOTE_LCD | 474 | #ifdef HAVE_REMOTE_LCD |
465 | if(btn & BUTTON_REMOTE) | 475 | if(btn & BUTTON_REMOTE) |
466 | remote_backlight_on(); | 476 | remote_backlight_on(); |