Skip to content

Add a custom-size option for unrecognized infrared tags - #62

Merged
i12bp8 merged 2 commits into
i12bp8:mainfrom
Hoggormino:custom-size
Sep 17, 2026
Merged

i12bp8 merged 2 commits into
i12bp8:mainfrom
Hoggormino:custom-size

Conversation

@Hoggormino

Copy link
Copy Markdown
Contributor

Summary

A tag whose type code is not in the profile table has no dimensions, so after the unknown-profile guard in #57 its Set Text, Set Image and WiFi Plugins actions are hidden. That is correct (a 0x0 job cannot be sent) but it leaves owners of unlisted infrared tags with nothing to do.

This adds a Set Custom Size action for exactly those targets: 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 and nothing new is transmitted.

  • 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, so Show Tag Info, Set Text and Set Image all see real dimensions.
  • Applied only when the barcode's type is absent from the table, so a real profile is never overridden.
  • 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, via a new tagtinker_type_is_known() helper.

Based on #57, which adds the guard this complements. Merge that one first.

Verification

Builds with zero warnings against release SDK 1.4.3 (API 87.1) and dev SDK 7f0b6e1c (API 88.2). No new clang-format drift.

Host tests (gcc, AddressSanitizer + UndefinedBehaviorSanitizer) against the real protocol/tagtinker_proto.c, 13 checks covering: tagtinker_type_is_known() for listed and unlisted codes; legacy two-field lines; five-field lines; a missing trailing colour field; an empty name; the serialize/parse round trip; and the safety property that a known type keeps its table size (208x112) rather than the custom one.

Tested on hardware (Flipper Zero, Momentum mntm-012, API 87.1), driven over the CLI:

  • With a target whose type code is not in the table, "Set Custom Size" is at menu index 2, confirming Set Text / Set Image / WiFi Plugins are hidden.
  • Dialling Width up 4 steps, Height up 3 steps and Colour one step, then Save, wrote …|40|32|1 to targets.txt, matching the 8 px step size exactly.
  • Re-opening the target, "Set Custom Size" had moved to index 5, confirming Set Text, Set Image and WiFi Plugins now occupy slots 2 to 4. Changing Width there wrote …|48|32|1.
  • No crash at any point.

🤖 Generated with Claude Code

Hoggormino and others added 2 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>
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>
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.

2 participants