Skip to content

feat: CONFIG_NICE_OLED_EXTERNAL_WIDGET — let external modules add widgets to the peripheral screen - #35

Open
delneet wants to merge 2 commits into
mctechnology17:mainfrom
delneet:feat/peripheral-user-animation
Open

feat: CONFIG_NICE_OLED_EXTERNAL_WIDGET — let external modules add widgets to the peripheral screen#35
delneet wants to merge 2 commits into
mctechnology17:mainfrom
delneet:feat/peripheral-user-animation

Conversation

@delneet

@delneet delneet commented Jul 3, 2026

Copy link
Copy Markdown

What

Adds CONFIG_NICE_OLED_EXTERNAL_WIDGET: an optional hook that lets a separate Zephyr module add a widget to the peripheral screen without forking this repo. When enabled, peripheral screen init calls:

extern int nice_oled_external_widget_init(lv_obj_t *parent);

which the external module provides. That's the whole interface — 18 lines including Kconfig and CHANGELOG.

  • Off by default; zero code and zero cost when disabled.
  • Enabling it without a providing module fails at link time by design (documented in the Kconfig help).
  • Users typically pair it with CONFIG_NICE_OLED_WIDGET_ANIMATION_PERIPHERAL=n / ..._STATIC_IMAGE_PERIPHERAL=n to hand the animation area over.

Why

Addresses the "More animations and fixed images for periphery" TODO without growing this repo: animation content can live in its own modules and evolve independently. First consumer: zmk-peripheral-animations — 10 procedurally rendered effects (plasma, rule 30, Sierpinski zoom, starfield, matrix rain, wireframe cube, …) computed live on the MCU, ~1-2 KB code each instead of stored frames.

Verification

Built against ZMK v0.3.0 (nice_nano_v2, corne_right nice_oled):

  • this branch + zmk-peripheral-animations, hook enabled — links and runs the external widget (10 effect variants built)
  • hook disabled (default) — byte-for-byte no behavioral change, central and peripheral builds clean

When enabled, the peripheral screen init calls
nice_oled_external_widget_init(parent), which another Zephyr module
provides (e.g. zmk-peripheral-animations for runtime-rendered
animations). Off by default; enabling it without a providing module
fails at link time by design. This generalizes the USER animation slot:
external modules can draw anything on the peripheral screen without
forking this repo.
@delneet
delneet force-pushed the feat/peripheral-user-animation branch from f4bed33 to 5fd2f9b Compare July 3, 2026 12:38
@delneet delneet changed the title feat: user-supplied peripheral animation (CONFIG_NICE_OLED_WIDGET_ANIMATION_PERIPHERAL_USER) feat: CONFIG_NICE_OLED_EXTERNAL_WIDGET — let external modules add widgets to the peripheral screen Jul 3, 2026
With both NICE_OLED_WIDGET_ANIMATION_PERIPHERAL=n and
NICE_OLED_WIDGET_STATIC_IMAGE_PERIPHERAL=n, draw_animation() was still
called and fell through to a random crystal frame, so the peripheral
art could never be turned off. It is now only drawn when one of the two
options is enabled — required when handing the area to an external
widget module.
@delneet
delneet marked this pull request as ready for review August 26, 2026 09:17
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