Files
uv-k5-v3-emulator/tools
mckero 46f0f37d58 Log keypresses, keep frames flowing when idle, blank the screen when off
Three things reported from actual use, plus the bug the logging exposed.

1. Keys are logged (source "key"), including refusals and presses while powered
   off. Without this there was no way to tell "the key never arrived" from "the
   firmware did something else with it" -- which is exactly what was needed below.

2. /stream resends the current frame every IDLE_FRAME_INTERVAL_S even when nothing
   changed. Change-detection alone made a static screen indistinguishable from a
   dead connection, and a client joining mid-idle stayed blank. Measured: 6 frames
   in 10 idle seconds, where before it was 0.

3. Off now actually blanks the screen. The dark panel moved to a .screenwrap
   wrapper and the <img> is hidden; setting a background on the <img> alone did
   nothing visible, because the image kept painting the last frame over it.

Then the reported bug: in the menu, UP/DOWN behaved like another MENU press. The
key log made it diagnosable and the cause was mine -- LONG_PRESS_AFTER_MS was set
to the firmware's own 400 ms boundary, but a deliberate click runs 100-500 ms, so
ordinary clicks sent tap AND held and the firmware acted on both:

  held DOWN  auto-repeated, gMenuCursor 3 -> 12 from one click
  held MENU  entered the submenu, gIsInSubMenu 0 -> 1

The UI threshold is now 900 ms, well clear of any click, and FIRMWARE_HELD_MS is a
separate constant so the two are not conflated again. Verified against the real
firmware: 120/300/500/800 ms clicks each move the cursor exactly +1 with
submenu=0, while a deliberate 1400 ms hold still auto-repeats (+9).
2026-08-28 10:38:58 +01:00
..
2026-08-28 09:59:34 +01:00
2026-08-28 09:59:34 +01:00