Skip to content

Throttle live-screen redraws to timer changes #10

Description

@PurpleSentinel

Problem

The track and rest session loops have no delay or change-detection guard. Every iteration calls Touch.LiveScreen(), which clears and transfers the complete 240×240 RGB565 framebuffer even though the displayed timer generally changes only once per second.

This wastes CPU and power, repeatedly reconfigures the touch controller, and increases SPI/I²C contention during the most important runtime state.

Relevant locations

  • main.py, track-session loop
  • main.py, rest-session loop
  • touch_drive.py, LiveScreen
  • lcd_1inch28.py, show

Acceptance criteria

  • Redraw only when the displayed second, warning state, or another visible value changes.
  • Add a bounded loop delay or use a monotonic scheduling approach.
  • Continue checking stop/clear gestures responsively between redraws.
  • Avoid rewriting touch-controller mode on every frame when the mode is unchanged.
  • Measure and document expected refresh/input responsiveness on hardware.
  • Add a test confirming redraw count remains bounded for a simulated session.

Resolution

Resolved by #17.

  • 48 host tests pass.
  • A simulated six-second session produces exactly six redraws.
  • A physical three-second MicroPython session produced exactly three redraws and 49 input checks.
  • Full-frame hardware redraws measured 56.2–65.4 ms.
  • Input is checked within 50 ms normally and approximately 115 ms worst-case during a redraw.
  • Five consecutive hardware frames produced only the two initial gesture-mode register writes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions