Skip to content

All session fixes + OpenEPaperLink Phase 1: honest tag handling, memory-safety, custom sizes, ESP32, OEPL - #1

Merged
Hoggormino merged 17 commits into
mainfrom
local-all-fixes
Sep 23, 2026
Merged

Hoggormino merged 17 commits into
mainfrom
local-all-fixes

Conversation

@Hoggormino

@Hoggormino Hoggormino commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

What this is

An integration branch that merges all seven fixes from this session into one tree. It is the exact build currently installed and tested on hardware (Flipper Zero, Momentum mntm-012, API 87.1).

Each change is also proposed upstream on its own, so this PR is a combined view rather than a replacement for those:

Upstream PR Commit Change
#56 6aa6796 NFC scan says what the tag data shows instead of naming a vendor or transport
#57 09bcf9a Guard unknown-profile targets and a full target list
#58 692e436 Fix the BMP row buffer overflow and show failed sends
#59 53ede94 Correct stale docs and the worker URL instructions
#60 146744d Silence the ESP32 console that shares UART0 with the Flipper link
#61 5e20479 Make the ESP32 worker URL a build option
#62 0447f12 Custom-size option for unrecognized infrared tags

This branch additionally includes OpenEPaperLink Phase 1 — new fork-only work with no upstream PR (the table above is the upstream-proposed fixes only). See the OpenEPaperLink section below.

Why

Field testing showed two shelf labels that TagTinker could not drive, and the app reported them in ways that claimed more than the code actually knows. Reviewing that surfaced a set of related defects. The theme is that the app should say only what it can observe, and should not crash or mislead when a tag is outside what it supports.

The most significant fixes:

  • Memory safety. tx_bmp_open() accepted 24- and 32-bit BMPs of any width, then read each row into a 128-byte stack buffer. A 24-bit BMP wider than 42 px overran it. Reproduced on a host build under AddressSanitizer as a 132-byte write into a 128-byte buffer.
  • A crash path. Targets whose type code is not in the profile table were offered Set Text, which reached malloc(0), treated as fatal by both official and Momentum firmware.
  • An out-of-bounds read. Manual barcode entry with all 16 slots used opened Target Actions with index -1, so Show Tag Info and LED Test indexed targets[-1].
  • Honest messaging. Scan results no longer assert a vendor or a display technology. The app cannot sense whether a label listens for infrared or radio, and now says only what the NFC data shows.
  • Coverage. Unrecognized infrared tags can be given a width, height and colour by hand, which restores Set Text and Set Image for them without guessing any protocol.

Verification

  • Builds with zero warnings against release SDK 1.4.3 (API 87.1) and dev SDK 7f0b6e1c (API 88.2), both per-branch and merged.
  • ESP32 firmware builds with ESP-IDF v5.2.8 for target esp32s2. The console fix is confirmed in the generated sdkconfig and in the binary, which loses the /dev/uart console string and shrinks by 8,368 bytes.
  • Host tests under AddressSanitizer and UndefinedBehaviorSanitizer: 39 checks on the NFC classifier including the public VUSION dump from upstream issue Add support for VUSION 2.2" (EDG2-0220-A) — 212×104 b/w i12bp8/TagTinker#51, 16 on the BMP header parser, and 13 on the custom-size persistence and profile logic.
  • On hardware: the scan messages, the unknown-barcode screen and its single-press Back, the BMP rejection showing "Send failed" without a crash, and the full custom-size flow verified by driving the buttons over USB and reading back the saved file.
  • Every pair of the seven branches merges without conflict, in any order, and also with upstream #54.

OpenEPaperLink Phase 1 (fork-only)

Owner-controlled support for OpenEPaperLink (OEPL) hardware through the access point's documented local HTTP API. The Flipper is a UI/controller; the AP does all radio and rendering. No proprietary retail-ESL protocol, no pairing, no radio, no network discovery.

  • oepl/tagtinker_oepl.{c,h} shapes the AP's documented POST /imgupload request and manages the owner's config and tag allow-list. It transmits nothing — the Flipper has no IP stack, so live push needs a follow-up ESP32-bridge frame and a real AP. This is the fully-testable FAP-side core.
  • Every push is gated by an owner-maintained allow-list (APP_DATA/oepl_tags.txt); no secrets are compiled in — AP host/port and an optional token live in APP_DATA/oepl.conf, read at runtime, never logged.
  • scenes/tagtinker_scene_oepl.c is a read-only status screen with a dry-run request preview (no send), reusing the existing text_box view.
  • test/ adds the repo's first host unit test: it compiles the real oepl/tagtinker_oepl.c against stub furi/storage headers (no SDK or hardware). ./test/run_oepl_test.sh → 24/24. .github/workflows/oepl-test.yml runs it on every PR (green on this branch).
  • docs/oepl-integration-plan.md has the 6-point plan and the Phase 1/2 split.

The /imgupload fields (mac, dither, file) are confirmed against the OEPL wiki; the tag-DB endpoint path is left configurable. Additive only — existing behaviour unchanged.

Notes for a reviewer

🤖 Generated with Claude Code

Hoggormino and others added 17 commits September 16, 2026 17:10
A tag whose type code is not in the profile table gets a zeroed profile:
kind Unknown, 0x0, Mono. NFC scan, targets.txt and web_job.txt (and the
unreachable phone-sync code) all create such targets, and because only
Segment was excluded they were offered Set Text, Set Image and WiFi
Plugins. Set Text on a 0x0 job reaches malloc(0), which the firmware
treats as a fatal error.

- Offer Set Text, Set Image and WiFi Plugins only for dot-matrix
  profiles found in the table; the app has no display size for others.
- Show Tag Info says the type is not in the profile table and which
  actions are hidden, instead of reporting "Size: 0x0" and "Color: Mono".
- Refuse a 0x0 text job before either sized text path allocates.
- Manual barcode entry with all 16 slots used now shows "Target List
  Full". It used to open Target Actions with selected_target -1, where
  Show Tag Info and LED Test index targets[-1].
- Widget buttons call back on press, short press and release, so the
  Back button went back twice. Act on the short press only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tx_bmp_open() accepted 24- and 32-bit BMPs of any width, then each source
row was read into uint8_t row_buf[128] on the stack. A 24-bit BMP wider
than 42 px, or a 1-bit BMP wider than 1024 px, overran it. The decoder
also reads one bit per pixel, so 24/32-bit files were misread anyway.
A host build of the previous code under AddressSanitizer reports a
132-byte write into the 128-byte buffer for a 24-bit, 43 px wide file.

- Accept only 1bpp and the stacked-plane "2bpp" layout, reject zero or
  over-16-bit sizes, and reject rows wider than TX_BMP_ROW_BUF_SIZE.
- Read header fields as uint32_t. Shifting into bit 31 of an int and
  negating INT32_MIN were undefined.
- The result screen showed "Flipped ;)" and played the success sound
  even when the send failed or was cancelled. Show "Send failed" with
  the error sound, or "Stopped" with no sound when cancelled with Back.
- Check for a stop request after the gap between frames of a sequence.
  tagtinker_ir_transmit() clears the stop flag on entry, so a Back
  pressed during the gap was lost and the next frame went out in full.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- README: the IR engine allocates heap for payloads, so drop
  "zero-allocation"; the drop folder takes the 1-bit and two-plane BMPs
  the image preparer exports, not any BMP, and type 1626 targets cap
  files at 24 KB; NFC scan only fills the barcode when the tag's NFC
  data decodes; there is no test-pattern feature; the FAQ now says this
  app needs a Flipper even though the protocol does not.
- CONTRIBUTING: the Android companion app was removed in d608afb.
- wrangler.toml pointed users at a "WiFi Setup -> Server URL" field that
  never existed. Say how the URL is actually set today.
- cloud_client.h described a runtime override through
  cloud_client_set_url(), which nothing calls.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
sdkconfig.defaults asked for a USB-Serial-JTAG console, but the ESP32-S2
has no such peripheral: the option depends on SOC_USB_SERIAL_JTAG_SUPPORTED,
which esp32s2 does not define. The choice therefore fell back to
ESP_CONSOLE_UART_DEFAULT, so boot and WiFi logs went out on UART0 at
115200 before wifi_link_init() switched it to 230400. That is the same
wire the framed protocol uses, and a log line printed mid-frame corrupts
it; the FAP then drops the frame on the CRC check.

- Select CONFIG_ESP_CONSOLE_NONE, as the Flipper's own devboard firmware
  does. Verified in the generated sdkconfig, not just the defaults file.
- Rename CONFIG_ESP32_WIFI_*_BUFFER_NUM to CONFIG_ESP_WIFI_*, which
  ESP-IDF v5.2 warned about on every build.
- wifi_link.c described UART1 on GPIO17/18. The code uses UART0, whose
  default pins are the ones wired to the Flipper header.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
cloud_client.h hard-coded the worker URL, and wrangler.toml pointed users
at a "WiFi Setup -> Server URL" field that has never existed, so anyone
self-hosting cloud-plugins/ had to edit a header. cloud_client_set_url()
exists but has no callers, and the UART protocol has no frame for it.

Add CONFIG_TT_CLOUD_URL (Kconfig.projbuild, menu "TagTinker") defaulting
to the current URL, and take TT_CLOUD_DEFAULT_URL from it. Setting it in
sdkconfig.defaults or through menuconfig is now enough; rebuild and
reflash still apply, and there is no hidden run-time channel.

Also says so in wrangler.toml and the README WiFi Plugins bullet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A tag whose type code is not in the profile table has no dimensions, so
after the unknown-profile guard its Set Text / Set Image / WiFi Plugins
actions are hidden. This adds a "Set Custom Size" action for those tags:
enter width, height and colour, and the graphics actions become usable.

The IR framing is identical to a table profile; only the screen geometry
differs, so no protocol is guessed. Custom size is applied only when the
barcode's type is not in the table, so a real profile is never overridden.

- New scene (VariableItemList): Width and Height in 8 px steps from 8 to
  800, Colour mono/red/yellow, and Save.
- tagtinker_target_refresh_profile() synthesizes a "Custom" profile from
  the stored size for unknown-type targets, so Show Tag Info, Set Text
  and Set Image all see real dimensions.
- targets.txt gains three optional fields (barcode|name|cw|ch|ccolor);
  older two-field lines still load, with no custom size.
- "Set Custom Size" appears in Target Actions only for unknown-type
  targets (tagtinker_type_is_known()).

Builds clean on release SDK 1.4.3 (API 87.1) and dev SDK; no new
clang-format drift.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The scan only sees NFC data. It cannot sense whether a label's display
listens for infrared or radio, so the messages now say what was found
instead of naming a vendor or a transport as fact.

- "VUSION tag / SES-imagotag uses radio, not IR" becomes "Likely radio
  tag / Link: nfc.imagotag.com / TagTinker is IR-only".
- Match an http:// or https:// link whose host is nfc.imagotag.com
  (case-insensitive), as prefix code 0x03/0x04 or inline after 0x00,
  instead of the substring "imagotag" anywhere in the URL. A "://"
  inside a path, query or fragment is not taken as the scheme.
- "Not a Pricer tag" becomes "Unrecognized tag / No ID TagTinker can
  decode"; "Unsupported chip" becomes "Unreadable chip / Chip answered
  but no data was read".
- Move the decision into tagtinker_nfc_classify() so it can be tested
  off-device.
- De-duplicate on UID and result together. The firmware reports a read
  that stops partway as a success with fewer pages, so a UID-only check
  could keep a tag stuck on "Unrecognized tag" after a partial first
  read.
- Announce an unreadable chip once until the field is empty. Those reads
  carry no UID, so UID de-duplication never applied and the message
  repeated on every poll.
- Bring the prompt back from the scene tick instead of a popup callback.
  A popup with a callback consumes every short press, so Back only
  dismissed the message and a second Back was needed to leave.
- Stop the scanner on the Back event rather than waiting for on_exit, so
  the poll loop is already winding down when the scene is popped and the
  join there is as short as possible. On device, leaving from a message
  takes exactly one Back.
- Move custom event ids to 200+. NfcScanEventSuccess was 100, the same
  id as the target menu's "+ Type Barcode" item.
- Stop the scan LED when "Target list full" ends scanning.
- README: add "Which tags work", with vendor-documented radio examples
  and a table of what each scan message means.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…cal API

TagTinker gains an OpenEPaperLink (OEPL) module that shapes the AP's
documented POST /imgupload request and manages the owner's config and tag
allow-list. This is the FAP-side, fully-testable core; it transmits nothing.
Live push needs the Phase 2 ESP32-bridge frame and a real access point.

Safety model:
- Only tags on APP_DATA/oepl_tags.txt can be targeted; every request build is
  gated by tagtinker_oepl_is_allowed().
- No proprietary retail-ESL protocol, no radio, no pairing, no discovery
  probing. The owner names their AP and lists their own tags.
- No secrets compiled in: AP host/port and an optional token live in
  APP_DATA/oepl.conf, read at runtime, never logged.

Contents:
- oepl/tagtinker_oepl.{c,h}: config loader, owned-tag allow-list, MAC
  normalizer, and the /imgupload multipart request builder (pure, testable).
- scenes/tagtinker_scene_oepl.c: read-only status screen with a dry-run
  request preview for the first owned tag (no transmission). Reuses the
  existing text_box view.
- Wiring: application.fam sources, scene table + enum, a main-menu entry.
- docs/oepl-integration-plan.md: the 6-point plan and the Phase 1/2 split.

Additive only; existing behaviour unchanged. ufbt build passes (Target 7,
API 87.1). Pure logic validated by a host reference test (21/21). The
/imgupload fields (mac, dither, file) are confirmed against the OEPL wiki;
the tag-DB endpoint path stays configurable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The repo had no unit harness (the earlier tests/ was removed in f144730).
This adds one that compiles the REAL oepl/tagtinker_oepl.c off-device against
stub furi/storage headers, so it needs no Flipper SDK or hardware and runs in
CI.

- test/oepl_test.c: 24 checks over MAC normalization, config + owned-tag
  allow-list loading (from test/fixtures/), the allow-list safety gate, and
  the exact POST /imgupload bytes + Content-Length.
- test/stubs/{furi.h,storage/storage.h}: minimal stubs; storage is backed by
  stdio with APP_DATA_PATH rooted at $OEPL_TEST_ROOT so the loaders read
  fixture files.
- test/run_oepl_test.sh: cc/clang/gcc runner (exit 0 = pass).
- test/fixtures/, test/README.md.

Not part of the FAP build (application.fam lists sources explicitly). The
tests transmit nothing and touch no network or radio. Verified: all 24 pass;
ufbt build unaffected (Target 7, API 87.1).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds .github/workflows/oepl-test.yml — a standalone GitHub Actions workflow
that compiles the real oepl/tagtinker_oepl.c against the test/stubs headers and
runs test/run_oepl_test.sh on ubuntu-latest (gcc, ~seconds, no SDK).

Standalone because the test/ harness and the existing build.yml currently live
on different branches; once they share a branch the job can be lifted into
build.yml verbatim. Verified locally: the exact CI command exits 0 (24/24).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
OpenEPaperLink Phase 1: owner-controlled tag push via the AP's local API
@Hoggormino Hoggormino changed the title All session fixes: honest unsupported-tag handling, memory-safety fixes, custom tag sizes, ESP32 config All session fixes + OpenEPaperLink Phase 1: honest tag handling, memory-safety, custom sizes, ESP32, OEPL Sep 23, 2026
@Hoggormino
Hoggormino merged commit a908a3f into main Sep 23, 2026
1 check passed
@Hoggormino
Hoggormino deleted the local-all-fixes branch September 23, 2026 08: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