6 Commits

Author SHA1 Message Date
Adolfo Reyna
eacc03a38c Implement 4-quadrant dirty rectangle optimization and 30 FPS limiting for ST7796
Add intelligent partial screen update system using bitwise XOR change detection
and 4-quadrant tracking (top-left, top-right, bottom-left, bottom-right). Each
changed pixel is routed to its quadrant, with sophisticated merge logic that
combines adjacent rectangles when beneficial (<40% overhead). This dramatically
reduces SPI bandwidth for UIs with scattered updates (e.g., corners, sidebars).

Key changes:
- 4-quadrant dirty rectangle tracking with automatic merging
- XOR-based change detection for fast byte-level comparison
- Expose st7796_set_window() for partial region updates
- 30 FPS frame rate limiter (33ms per frame) to prevent excessive refreshes
- Smart sleep timing when frame rate limit is active

Performance: Up to 99% reduction in SPI traffic for corner-based UIs
(e.g., 4 small regions vs full 480x320 screen updates).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-11 12:56:10 -05:00
Adolfo Reyna
fe5d58b663 Refactor power saving logic into display drivers and add ST7789 support 2026-02-10 22:20:53 -05:00
Adolfo Reyna
8cbb95b181 Add auto-sleep/wake functionality with timer-based dimming
- Added PWM brightness control to ST7796 driver (0-100%)
- Implemented hardware sleep mode for ST7796 (saves ~150mA)
- Added sleep/wake functions preserving framebuffer and settings
- Implemented timer-based inactivity detection (checks every 10s)
- Auto-sleep after 5 minutes of no user input
- Touch controller remains active during TFT sleep for instant wake
- E-ink display also sleeps after timeout, requires re-init on wake
- Added hardware_pwm library dependency to CMakeLists.txt
- Brightness and sleep/wake methods exposed through display abstraction layer
2026-02-10 20:29:10 -05:00
Adolfo Reyna
d2fd001e70 Add display color inversion flag and logic for Feather TFT 2026-01-30 23:02:53 -05:00
Adolfo Reyna
435a5caa56 tic tac toe works on touch and eink 2026-01-29 17:16:59 -05:00
Adolfo Reyna
adfbef7228 abstracting display, touch and sd 2026-01-28 20:12:41 -05:00