Skip to content

Set Text: keep the text planes at 1 bit per pixel - #66

Open
bey0ne wants to merge 1 commit into
i12bp8:mainfrom
bey0ne:text-packed-render
Open

bey0ne wants to merge 1 commit into
i12bp8:mainfrom
bey0ne:text-packed-render

Conversation

@bey0ne

@bey0ne bey0ne commented Oct 27, 2026 •

Copy link
Copy Markdown

Set Text: keep the text planes at 1 bit per pixel

Problem

The full-image text path renders both planes at one byte per pixel. For a
208x112 red tag that is ~47 KB, plus the encoded payload (~52 KB in all).
With the app running only ~45 KB of heap was left (momentum firmware),
so malloc() failed and the Flipper crashed (out of memory).

Change

Render the text 16 rows at a time into 1-bit planes, as the Color 2.6 path
already does, and encode them with tagtinker_encode_fn_payload(). Peak use
drops to ~12 KB. tx_render_color26_text_plane() now calls the same generic
helper.

Tested

  • Host check over 1944 cases (6 sizes, 6 texts, accent / plain, invert,
    padding 0/10/20 %, Auto / Raw / RLE): payloads byte-identical to the old
    code, ASan + UBSan clean.
  • Flipper Zero, firmware mntm 12, Pricer F14 type 1327: Set Text no
    longer crashes and the text is displayed.

The full-image text path rendered both planes at one byte per pixel:
about 47 KB for a 208x112 red tag, plus the payload. With the app
running only ~45 KB of heap is left on a Flipper with official firmware
1.5.1, so malloc() failed and the device crashed.

Render the text 16 rows at a time into 1-bit planes, as the Color 2.6
path already does, and encode them through tagtinker_encode_fn_payload().
Peak use drops to about 12 KB. The payload is unchanged: a host check
over 1944 cases (sizes, texts, accent, invert, padding, compression)
gives byte-identical results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYkmJ3RnCgGZEBKnfRJt5x

This branch has not been deployed

No deployments
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