Skip to content

Add SpotPear ESP32-S3-LCD-1.54 (MUMA) board port + tiny 240x240 layout - #108

Open
bluh-jcrubioa wants to merge 1 commit into
HermannBjorgvin:mainfrom
bluh-jcrubioa:spotpear-s3-154-port
Open

Add SpotPear ESP32-S3-LCD-1.54 (MUMA) board port + tiny 240x240 layout#108
bluh-jcrubioa wants to merge 1 commit into
HermannBjorgvin:mainfrom
bluh-jcrubioa:spotpear-s3-154-port

Conversation

@bluh-jcrubioa

Copy link
Copy Markdown

What

Adds an (unofficial, community) board port for the SpotPear ESP32-S3-LCD-1.54-MUMA (N16R8) — the project's first non-AMOLED panel: a plain 4-wire SPI ST7789 240×240 IPS. Build env: spotpear_s3_154.

Hardware

  • Display: ST7789 240×240 via Arduino_ESP32SPI + Arduino_ST7789 @ 40 MHz (RGB order, INVON for the IPS). Backlight is LEDC PWM on an active-low GPIO (duty inverted; the panel has no brightness command).
  • Touch: CST816 @ 0x15, reusing the same inline FocalTech-style reader as the 1.8.
  • Power / IMU / sound: stubbed (BOARD_HAS_BATTERY/IMU/SOUND=0; no PMU). No rotation.
  • Pinout verified from the xiaozhi-esp32 sp-esp32-s3-1.54-muma board config plus an on-hardware I2C scan — this board does not follow the Waveshare 1.54 pinmap despite SpotPear's wiki linking to it. (LCD SCLK=4, MOSI=2, CS=5, DC=47, RST=38; BL=42 active-low; touch SDA=11/SCL=7, INT=12, RST=6; BOOT=0.)

The env mirrors waveshare_amoled_18 (S3, 16 MB flash, qio_opi OPI PSRAM) minus the unused SensorLib/XPowersLib deps.

UI: new "tiny" layout breakpoint (H < 300)

240×240 previously fell into the compact (368×448) branch and overflowed badly. This adds a dedicated tiny branch and finishes the parameterization so it renders cleanly:

  • Parameterized in-panel fonts (pct / pill / reset) + bar height. This also fixes a pro-account update path that hard-set the session % to styrene_48 regardless of layout — so the 5h number rendered huge and clipped.
  • Header title dropped on tiny to reclaim vertical space → taller 96 px panels.
  • Compact 5h / 7d pills (were Current / Weekly) so the label doesn't collide with the number at 240 px.
  • Plain-ASCII status line on tiny (anim_plain): the small styrene font lacks the spinner and ellipsis glyphs, which otherwise render as tofu boxes on both sides.
  • Board-scoped -DBOOT_TO_USAGE: boot straight to the usage view (this board has no dedicated splash-cycle button); the splash is still reachable by tapping.

Existing AMOLED boards are unaffected — the large/compact branches keep their prior hard-coded values, and the boot-screen change is gated behind the new build flag.

Verification

Display and the full usage layout were verified on real hardware via the screenshot serial command (framebuffer PNGs), driven end-to-end by the daemon over BLE pushing live usage.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GFEedUyQB8UVb2HUVgmAdB

First non-AMOLED port: a 4-wire SPI ST7789 240x240 IPS panel (Arduino_ST7789),
CST816 touch @0x15, LEDC-PWM active-low backlight, stubbed power/IMU/sound
(no PMU). Build env `spotpear_s3_154` mirrors waveshare_amoled_18 (S3, 16MB
flash, qio_opi PSRAM). Pinout verified from the xiaozhi-esp32
`sp-esp32-s3-1.54-muma` config plus an on-hardware I2C scan (this board does
NOT follow the Waveshare 1.54 pinmap).

Adds a third compute_layout() breakpoint (H<300, "tiny") so 240x240 renders
correctly instead of overflowing the compact (368x448) layout:

- Parameterize the in-panel fonts (pct / pill / reset) and bar height. This also
  fixes a pro-account update path that hard-set the session % to styrene_48
  regardless of the layout, so the 5h number rendered huge and clipped.
- Drop the "Usage" header on tiny to reclaim vertical space; taller 96px panels.
- Compact "5h" / "7d" pills (were "Current" / "Weekly") to avoid colliding with
  the number at 240px width.
- Plain-ASCII status line on tiny (anim_plain): the small styrene font lacks the
  spinner and ellipsis glyphs, which rendered as tofu boxes on both sides.
- Board-scoped -DBOOT_TO_USAGE: boot straight to the usage view (this board has
  no dedicated splash-cycle button); the splash stays reachable by tapping.

Existing AMOLED boards are unaffected: the large/compact branches keep their
prior hard-coded values, and the boot-screen change is gated behind the new
build flag. Display and full usage layout verified on real hardware via the
`screenshot` serial command (framebuffer PNGs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFEedUyQB8UVb2HUVgmAdB

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new community board port for the SpotPear ESP32-S3-LCD-1.54-MUMA (ST7789 240×240) and extends the shared UI to properly support a 240×240 “tiny” breakpoint without impacting existing AMOLED targets.

Changes:

  • Added spotpear_s3_154 PlatformIO environment and a full HAL implementation set under firmware/src/boards/spotpear_s3_154/.
  • Introduced a new “tiny” UI layout breakpoint (H < 300) with parameterized fonts/sizes and an ASCII-only status line option.
  • Added a board-scoped BOOT_TO_USAGE path to start directly on the usage screen.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
firmware/src/ui.cpp Adds a tiny breakpoint and parameterizes UI sizing/fonts/labels; updates status/battery/logo visibility behavior.
firmware/src/main.cpp Adds BOOT_TO_USAGE conditional to boot directly into usage view for boards without a splash-cycle button.
firmware/src/boards/spotpear_s3_154/touch.cpp Implements CST816 I2C touch reader with INT-driven “data ready” behavior.
firmware/src/boards/spotpear_s3_154/TODO-PINS.md Documents verified pinout and board-specific bring-up notes.
firmware/src/boards/spotpear_s3_154/sound.cpp Adds no-op sound HAL stubs for a soundless board.
firmware/src/boards/spotpear_s3_154/power.cpp Adds minimal power HAL stubs (no PMU/battery reporting).
firmware/src/boards/spotpear_s3_154/input.cpp Implements primary button input HAL (GPIO0 BOOT).
firmware/src/boards/spotpear_s3_154/imu.cpp Adds IMU HAL stub (no rotation).
firmware/src/boards/spotpear_s3_154/display.cpp Implements ST7789 SPI display + LEDC PWM backlight (active-low).
firmware/src/boards/spotpear_s3_154/caps.cpp Provides BoardCaps for the new board.
firmware/src/boards/spotpear_s3_154/board.h Defines board pinout/capability macros.
firmware/src/boards/spotpear_s3_154/board_init.cpp Initializes the shared I2C bus (Wire.begin with board SDA/SCL).
firmware/platformio.ini Adds env:spotpear_s3_154 with board filters and build flags (incl. BOOT_TO_USAGE).
CLAUDE.md Documents the new port and the updated responsive layout breakpoints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// ---- Capability flags ---- (keep in sync with caps.cpp)
#define BOARD_HAS_SECONDARY_BUTTON 0
#define BOARD_HAS_ROTATION 0 // ST7789 rotates natively; auto-rotate off
#define BOARD_HAS_IMU 0 // QMI8658 present but unused for now
Comment thread firmware/src/ui.cpp
Comment on lines +596 to +597
lv_obj_set_style_text_font(lbl_session_pct, L.usage_pct_font, 0);
lv_label_set_text(lbl_session_label, L.session_pill);
Comment thread firmware/src/ui.cpp
Comment on lines +498 to 500
panel_session = make_usage_panel(usage_group, L.content_y, L.session_pill,
&lbl_session_pct, &lbl_session_label,
&bar_session, &lbl_session_reset);
@HermannBjorgvin

Copy link
Copy Markdown
Owner

Got pics?

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.

3 participants