Skip to content

Add per-fragment blink ("b") for custom app text fragments#827

Open
fluffyspace wants to merge 1 commit into
Blueforcer:mainfrom
fluffyspace:feature/per-fragment-blink
Open

Add per-fragment blink ("b") for custom app text fragments#827
fluffyspace wants to merge 1 commit into
Blueforcer:mainfrom
fluffyspace:feature/per-fragment-blink

Conversation

@fluffyspace

Copy link
Copy Markdown

What

Adds an optional per-fragment blink key "b" (milliseconds) to custom-app text fragments. When b > 0, that fragment blinks at the given interval while the other fragments stay steady. When b is absent or 0, the fragment falls back to the existing app-wide blinkText value, so all existing payloads behave exactly as before.

Why

Text fragments already support per-fragment color ("c"), but blinking is only available app-wide via blinkText, which blinks the entire text. There was no way to blink a single fragment — e.g. a clock separator HH : MM where only the : pulses (the behaviour of the built-in Time app, previously impossible to reproduce in a custom app). See #366.

How

  • Apps.h: add std::vector<int> blinks to CustomApp.
  • DisplayManager.cpp: parseFragmentsText takes an optional std::vector<int>* and reads each fragment's "b" into it; the notification call site is unchanged (passes the default nullptr).
  • Apps.cpp: both fragment render loops pick the per-fragment blink with app-wide fallback: (i < blinks.size() && blinks[i] > 0) ? blinks[i] : ca->blink.
  • docs/api.md: document "b".

Backward compatible; notification rendering untouched.

Example

{ "text": [ {"t":"12"}, {"t":":","b":500}, {"t":"34"} ] }

Testing

Built for ulanzi (espressif32@6.3.0) and flashed to a TC001 via OTA. Verified by sampling the device framebuffer: with the payload above, exactly the two colon pixels toggle at 500 ms while the digit pixels stay lit. Existing single-string and app-wide blinkText payloads unaffected.

Text fragments already carry a per-fragment color ("c"). This adds an
optional per-fragment blink interval "b" (in ms): when > 0 that fragment
blinks while the others stay steady. When "b" is absent or 0 the fragment
falls back to the app-wide blinkText value, so existing payloads behave
exactly as before.

This makes effects like a blinking clock separator (HH : MM) possible in
custom apps, which previously could not be done -- blinkText blinks the
entire text at once.

- Apps.h: add std::vector<int> blinks to CustomApp
- DisplayManager.cpp: parseFragmentsText reads an optional "b" into a
  parallel blinks vector via an optional pointer arg; the notification
  call site is unchanged
- Apps.cpp: both fragment render loops select the per-fragment blink with
  app-wide fallback
- docs/api.md: document the new "b" property

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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