Add per-fragment blink ("b") for custom app text fragments#827
Open
fluffyspace wants to merge 1 commit into
Open
Add per-fragment blink ("b") for custom app text fragments#827fluffyspace wants to merge 1 commit into
fluffyspace wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional per-fragment blink key
"b"(milliseconds) to custom-app text fragments. Whenb > 0, that fragment blinks at the given interval while the other fragments stay steady. Whenbis absent or0, the fragment falls back to the existing app-wideblinkTextvalue, so all existing payloads behave exactly as before.Why
Text fragments already support per-fragment color (
"c"), but blinking is only available app-wide viablinkText, which blinks the entire text. There was no way to blink a single fragment — e.g. a clock separatorHH : MMwhere only the:pulses (the behaviour of the built-in Time app, previously impossible to reproduce in a custom app). See #366.How
Apps.h: addstd::vector<int> blinkstoCustomApp.DisplayManager.cpp:parseFragmentsTexttakes an optionalstd::vector<int>*and reads each fragment's"b"into it; the notification call site is unchanged (passes the defaultnullptr).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-wideblinkTextpayloads unaffected.