Migrate to Waveshare ESP32-S3-Touch-AMOLED-2.16 with auto-rotation, splash, and battery

Full hardware swap from Panlee SC01 Plus (480×320 IPS) to Waveshare 2.16"
square AMOLED (480×480, CO5300 + CST9220 + AXP2101 + QMI8658). Library
stack moves to Arduino_GFX, SensorLib, XPowersLib on the pioarduino
platform 55.03.38-1 (Arduino Core 3.x).

UI:
- 4 screens (splash, usage, controller, bluetooth) with 3-button physical
  navigation: GPIO 0 = prev, AXP PKEY = cycle, GPIO 18 = next.
- IMU-driven 90° auto-rotation. CO5300 can't rotate via MADCTL, so flush
  callback does CPU strip-rotation in PARTIAL render mode. Rotation
  transitions use AMOLED brightness flash (instant black → redraw → ramp).
- Battery indicator (Lucide icons) in upper-right, RGB565A8 alpha so it
  blends over the splash animations.
- USB plugged/unplugged auto-switches between Usage and Controller
  screens (suppressed while on splash).
- Fonts and icons re-scaled ~1.9× for the higher-DPI panel; 20px margins
  to clear rounded corners.

Splash:
- 13 × 20×20 pixel-art creature animations sourced from
  claudepix.vercel.app via tools/scrape_claudepix.js (scraper handles
  both PRESET creature-engine and standalone FRAMES+PAL formats).
  tools/convert_to_c.js emits firmware/src/splash_animations.h.
  Attribution preserved in README and the generated header.

Tooling:
- tools/png_to_lvgl.js converts alpha PNGs to LVGL RGB565A8 (planar
  layout, with --tint to colorize Lucide black-on-transparent sources).
- tools/scrape_claudepix.js, tools/convert_to_c.js for the splash
  pipeline.

Docs:
- New worktree CLAUDE.md with hardware pin map, file inventory, build
  commands, and the 8 critical gotchas (CO5300 rotation, OPI PSRAM,
  pioarduino requirement, LVGL 9 font patching, centralized touch read,
  even-aligned flush regions, touch swap/mirror values, RGB565A8 layout).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hermann Björgvin Haraldsson
2026-05-09 22:04:04 +00:00
co-authored by Claude Opus 4.7
parent 10b8052bcc
commit 97a5443601
65 changed files with 121542 additions and 801 deletions
+8 -20
View File
@@ -1,20 +1,12 @@
/*******************************************************************************
* Size: 28 px
* Bpp: 4
* Opts: --font /home/hermann/Documents/Code/Personal/claude-usage-monitor-sc01-plus/assets/StyreneB-Regular.otf -r 0x20-0x7E --size 28 --format lvgl --bpp 4 --no-compress -o /home/hermann/Documents/Code/Personal/claude-usage-monitor-sc01-plus/firmware/src/font_styrene_28.c --lv-include lvgl.h
* Opts: --font /home/hermann/Documents/Code/Personal/claude-usage-monitor-sc01-plus/.claude/worktrees/waveshare-esp32-s3-touch-amoled-2.16/assets/StyreneB-Regular.otf -r 0x20-0x7E --size 28 --format lvgl --bpp 4 --no-compress -o /home/hermann/Documents/Code/Personal/claude-usage-monitor-sc01-plus/.claude/worktrees/waveshare-esp32-s3-touch-amoled-2.16/firmware/src/font_styrene_28.c --lv-include lvgl.h
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl.h"
#endif
#ifndef FONT_STYRENE_28
#define FONT_STYRENE_28 1
#endif
#if FONT_STYRENE_28
/*-----------------
* BITMAPS
@@ -2795,9 +2787,6 @@ static const lv_font_fmt_txt_kern_pair_t kern_pairs =
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
#endif
static const lv_font_fmt_txt_dsc_t font_dsc = {
.glyph_bitmap = glyph_bitmap,
@@ -2808,7 +2797,7 @@ static const lv_font_fmt_txt_dsc_t font_dsc = {
.cmap_num = 1,
.bpp = 4,
.kern_classes = 0,
.bitmap_format = 0
.bitmap_format = 0,
};
@@ -2819,22 +2808,21 @@ static const lv_font_fmt_txt_dsc_t font_dsc = {
/*Initialize a public general font descriptor*/
const lv_font_t font_styrene_28 = {
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,
.release_glyph = NULL,
.line_height = 30,
.base_line = 6,
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 30, /*The maximum line height required by the font*/
.base_line = 6, /*Baseline measured from the bottom of the line*/
.subpx = LV_FONT_SUBPX_NONE,
.release_glyph = NULL,
.kerning = 0,
.static_bitmap = 0,
.underline_position = -1,
.underline_thickness = 2,
.dsc = &font_dsc,
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
.fallback = NULL,
.user_data = NULL,
};
#endif /*#if FONT_STYRENE_28*/