Skip to content

Add LilyGO T4-S3 board target + UI layout refactor#3

Closed
jjhuff wants to merge 3 commits into
mainfrom
jjhuff/lilygo-t4s3-port
Closed

Add LilyGO T4-S3 board target + UI layout refactor#3
jjhuff wants to merge 3 commits into
mainfrom
jjhuff/lilygo-t4s3-port

Conversation

@jjhuff

@jjhuff jjhuff commented May 15, 2026

Copy link
Copy Markdown
Owner

Fork-internal review PR — not intended for upstream yet.

Summary

Adds a second board target (LilyGO T4-S3, 450×600 portrait, RM690B0 + CST226SE + SY6970) alongside the existing Waveshare 2.16" 480×480.

Commits

  1. Multi-board scaffolding + LilyGO bring-up — splits `display_cfg.h` into a per-board header dispatcher, adds typedef driver aliases and capability flags. Includes the SY6970 `0x6A` address fix, RM690B0 column offset (482-wide controller → 450-wide viewport), and panel-power sequencing via `power_early_enable()` before `gfx->begin()`.
  2. screenshot.sh: honor SCREENSHOT_START dimensions — was hardcoded to 480×480, now uses the panel size the firmware reports.
  3. Centralize UI layout in ui_layout.h — adapts PR Add macOS host support and Waveshare 1.8" AMOLED board port HermannBjorgvin/Clawdmeter#5's layout-header approach. Currently only one per-board override (`UI_BT_LINE_FONT` styrene_24 on LilyGO to fix MAC truncation).

Test plan

  • `pio run -e waveshare_amoled_216` builds clean
  • `pio run -e lilygo_t4s3` builds clean
  • Hardware bring-up: display, touch, BLE, SY6970 all init OK on T4-S3
  • Splash / Usage / Bluetooth screens render correctly on 450×600
  • BLE pairs with daemon as "Claude Controller"

jjhuff and others added 3 commits May 14, 2026 21:47
Split board-specific config out of display_cfg.h into per-board headers
selected by a -DBOARD_* flag; display_cfg.h becomes a 10-line dispatcher.
Each board header declares pins, driver typedefs (DisplayDriver, TouchDriver,
PmuDriver, ImuDriver), and capability flags (HAS_IMU, HAS_PMU_BUTTON,
HAS_BTN_FWD) so shared code can gate features without naming a board.

LilyGO T4-S3 specifics:
* RM690B0 450x600 AMOLED via QSPI; CST226SE touch; SY6970 charger; no IMU.
* SY6970 is at I2C 0x6A (XPowersLib's SY6970_SLAVE_ADDRESS), not 0x6B.
* PMICEN (GPIO 9) gates the panel rail, so panel power must come up before
  gfx->begin() or the display init sequence clocks against a dead panel.
  Split power_early_enable() out of power_init() and call it from setup()
  before the display is touched. No-op on the Waveshare which self-powers.
* RM690B0 controller is 482px wide but only 450 are visible, so x-coords
  get +16 via the col_offset1/col_offset2 constructor params. New
  LCD_COL_OFFSET macro keeps the Waveshare path zero.
* Only one user button (BOOT/GPIO 0), so a long-press on it cycles screens
  / advances splash animations to substitute for the missing middle button.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Firmware reports panel width/height with the SCREENSHOT_START header, but
the script was hardcoded to ffmpeg -video_size 480x480, which mangled the
output for the 450x600 LilyGO panel. Pass the parsed (w, h) through to ffmpeg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move per-board layout numbers (margins, panel sizes, font choices, splash
cell size) out of ui.cpp / splash.cpp into a single ui_layout.h with #if
branches per board. Shared values stay outside any ifdef; overrides are
added only where the original metrics actually break — currently just
UI_BT_LINE_FONT, which drops to styrene_24 on the 450-wide LilyGO so the
BT-screen MAC line doesn't clip at the right panel edge.

Adapted from the approach in PR HermannBjorgvin#5 (1.8" AMOLED port). Both Waveshare and
LilyGO envs build; BT screen verified on LilyGO hardware.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jjhuff

jjhuff commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Re-opened against upstream as HermannBjorgvin#11.

@jjhuff jjhuff closed this May 15, 2026
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