fix(eink): queue input so a burst of taps survives a blocking refresh

The joystick directions and Back were never begin()'d, so on the e-ink build
they never claimed a GPIOTE channel — edges landing during a blocking panel
refresh were lost and the IRQ-capture work didn't reach them. begin() them.

Even with edges captured, rapid taps of one direction replayed into a single
check() and collapsed into a double/triple-click event the navigation handler
ignores, and the loop only ever dispatched one key per render. So:

- MomentaryButton: for multiclick=false buttons emit one CLICK per completed
  release (one per check() call) instead of collapsing — each tap stays a
  discrete key. multiclick=true buttons (double/triple) are unchanged.
- UITask: add a key FIFO; drain each direction fully into it, apply the whole
  queued burst, then redraw once. N taps captured during a refresh become N
  navigation steps at the cost of a single refresh. Also fixes losing a key
  when two buttons fire in the same loop iteration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-30 22:10:18 +02:00
co-authored by Claude Opus 4.8
parent 57ebd80fa7
commit 8c70acc3ef
3 changed files with 91 additions and 37 deletions
+11
View File
@@ -149,6 +149,17 @@ class UITask : public AbstractUITask {
char handleDoubleClick(char c);
char handleTripleClick(char c);
// Key FIFO: a burst of taps captured during a blocking refresh (e-ink) is
// drained from the buttons into this queue, then all keys are applied before
// a single redraw — so rapid navigation steps neither get lost nor cost one
// slow refresh each. Also fixes losing a key when two buttons fire in the
// same loop iteration.
static const uint8_t KEY_QUEUE_SIZE = 16;
char _key_queue[KEY_QUEUE_SIZE];
uint8_t _kq_head = 0, _kq_tail = 0;
void enqueueKey(char c);
bool dequeueKey(char& c);
void setCurrScreen(UIScreen* c);
public: