Skip to content

Touch works in busy games again; SKIP / pause buttons in JK cutscenes; menu taps land - #48

Merged
finger563 merged 1 commit into
mainfrom
fix/touch-interrupt-priority
Nov 29, 2026
Merged

finger563 merged 1 commit into
mainfrom
fix/touch-interrupt-priority

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Summary

Touch in GBA, SNES, Jedi Knight and MotS was laggy or dead, while Genesis and the launcher worked.

The cause: the BSP's interrupt task, which reads the touch screen, ran at the BSP's default priority 0, the idle task's level. It only ran while every other task was waiting. A probe at priority 0 waited up to 40 ms per wake-up in JK / MotS play and lost about a third of its runs.

A connected gamepad hides the touch overlay, which is why touch looked fine until the gamepad was unplugged.

  • sdkconfig.defaults: CONFIG_M5STACK_TAB5_INTERRUPT_PRIORITY=21, above the games' main task and the video task (both 20). The same probe at 21 waits under 0.5 ms. A read is about a millisecond of I2C, and only happens while a finger is down.
  • JK / MotS cutscenes: these, the opening crawls included, ignore taps (Escape skips one, Space pauses it). While one plays, the touch controls are a SKIP ⏭ button (Escape) and the pause menu's ⏸, which pauses the cutscene too.
  • OpenJKDF2 4a881c4c (ESP32: a tap near a menu control lands on it OpenJKDF2#10, merged): a tap near a menu control lands on it. The menus' text buttons are about 2.5 mm tall on the Tab5, and finger taps landed a few mm off.

Testing (Tab5)

Verified with a test build that logged touch reports and the probe every 5 s:

  • GBA: touch works.
  • MotS: the menus and play take touch.
  • Gamepad: with a Backbone Pro plugged in and then unplugged mid-game, about 400 touch reports per 5 s arrived right after the unplug. The probe showed nothing left busy after the unplug.
  • Cutscenes: SKIP skips JK's opening crawl.
  • Menu snapping: a remote tap where a real tap had missed MotS's Ok now goes through.

The probe was a test hook and isn't in this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

…; menu taps land

Touch in GBA, SNES, Jedi Knight and MotS was laggy or dead, while Genesis and
the launcher were fine. The BSP's interrupt task, which reads the touch
screen, ran at the BSP's default priority 0, the idle task's: it ran only
while every other task waited. A probe at that priority waited up to 40 ms a
wake-up in JK / MotS play and lost a third of its runs. (A gamepad hides the
touch overlay, so touch looked fine until it was unplugged.)

- sdkconfig.defaults: CONFIG_M5STACK_TAB5_INTERRUPT_PRIORITY=21, above the
  games' main task and the video task (20). The same probe at 21 waits under
  0.5 ms. A read is about a millisecond of I2C, and only while a finger is
  down.
- Jedi Knight / MotS cutscenes, the opening crawls included, ignore taps
  (Escape skips one, Space pauses it). While one plays the touch controls are
  a SKIP button (Escape) and the pause menu's button, which pauses the
  cutscene too.
- OpenJKDF2 4a881c4c: a tap near a menu control lands on it. The menus' text
  buttons are about 2.5 mm tall on the Tab5, and finger taps landed a few mm
  off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
@finger563
finger563 merged commit 360db04 into main Nov 29, 2026
1 check passed
@finger563
finger563 deleted the fix/touch-interrupt-priority branch November 29, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant