Skip to content

feat(lora): gate region→preset map + TINY presets on firmware capability#5941

Merged
jamesarich merged 1 commit into
mainfrom
claude/musing-banzai-87b2d5
Jun 24, 2026
Merged

feat(lora): gate region→preset map + TINY presets on firmware capability#5941
jamesarich merged 1 commit into
mainfrom
claude/musing-banzai-87b2d5

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Firmware older than 2.8 has no concept of the LoRa region→preset legality map (protobufs #951) or the new TINY_FAST/TINY_SLOW presets. Surfacing them on a pre-2.8 node invites confusion — e.g. narrow presets appearing as legal options on the US region — so this gates both behind a firmware capability, per the follow-up discussed on Discord.

🌟 New Features

  • Add Capabilities.supportsLoraRegionPresetMap (firmware ≥ 2.8.0) to centralize the gate alongside the other firmware feature flags.

🛠️ Refactoring & Architecture

  • LoRaConfigScreen: apply the region→preset map and hide the TINY_FAST/TINY_SLOW presets only when the target node's firmware supports them. The capability is built from state.metadata.firmware_version, which is per-target, so remote admin is gated on the remote node's firmware rather than the locally-connected device.
  • The legality map is a function of firmware version + region (not the device instance), so the locally-cached map is reused for remote admin once the remote node is known to support it — this drops the prior local-only gate, which was overly conservative.
  • Extracted preset-list construction into a buildPresetItems helper to keep LoRaConfigScreen under the detekt cyclomatic-complexity limit.

Behavior

  • Local or remote ≥ 2.8 → constrained preset list + TINY presets, using the cached legality map.
  • < 2.8, or target metadata not yet fetched → unconstrained list, TINY hidden (conservative default; firmware still enforces its own rules).

Testing Performed

No new tests — the change is a UI gate over existing logic. Verified locally:

  • :core:model:allTests (32 tests) pass.
  • spotlessCheck, detekt, and :feature:settings:compileAndroidMain pass.

Pre-2.8 firmware has no concept of the region→preset legality map or the
TINY_FAST/TINY_SLOW presets, so showing them invites confusion (e.g. narrow
presets surfacing on the US region). Gate both behind a firmware capability.

- Add Capabilities.supportsLoraRegionPresetMap (firmware >= 2.8.0).
- Apply the map and hide the TINY presets only when the target node supports
  them. Capability reads the per-target node's metadata, so remote admin is
  gated on the remote node's firmware, not the local device's.
- The legality map is a function of firmware version + region (not device
  instance), so the locally-cached map is reused for remote admin once the
  remote node is known to support it — dropping the prior local-only gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jamesarich jamesarich requested a review from thebentern June 24, 2026 21:49
@jamesarich jamesarich enabled auto-merge June 24, 2026 21:49
@github-actions github-actions Bot added the enhancement New feature or request label Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🖼️ Preview staleness check — advisory

This PR modifies UI composables but does not update any *Previews.kt files.

Previews power screenshot tests and in-app docs screenshots. Keeping them current ensures visual regression coverage stays accurate.

Changed UI files:

feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/LoRaConfigItemList.kt

What to check:

Pattern Preview file convention
feature/{name}/…/ui/ or component/ feature/{name}/…/*Previews.kt
core/ui/…/ core/ui/…/ (previews colocated)

Adding previews checklist:

  1. Create or update a *Previews.kt file in the same module with @PreviewLightDark
  2. Add @Suppress("PreviewPublic") if the preview is consumed by screenshot-tests
  3. Add corresponding @PreviewTest function in screenshot-tests/src/screenshotTest/
  4. Run ./gradlew :screenshot-tests:updateDebugScreenshotTest to generate reference images

If this PR does not require preview updates (e.g., logic-only change, non-visual refactor), add the skip-preview-check label to dismiss.

@github-actions

Copy link
Copy Markdown
Contributor

📄 Docs staleness check — advisory

This PR modifies user-facing UI source files but does not update any page under docs/en/user/ or docs/en/developer/.

⚠️ Doc changes propagate to 3 consumers: in-app docs browser, Jekyll site (GitHub Pages), and meshtastic.org (Docusaurus sync). Updating a page in docs/en/ automatically flows to all three.

Changed source files:

feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/LoRaConfigItemList.kt

What to check:

Changed area Likely doc page
feature/messaging/ docs/en/user/messages-and-channels.md
feature/node/ docs/en/user/nodes.md or docs/en/user/node-metrics.md
feature/map/ docs/en/user/map-and-waypoints.md
feature/connections/ docs/en/user/connections.md
feature/settings/ docs/en/user/settings-radio-user.md or docs/en/user/settings-module-admin.md
feature/firmware/ docs/en/user/firmware.md
feature/intro/ docs/en/user/onboarding.md
feature/discovery/ docs/en/user/discovery.md
feature/docs/ Internal docs infrastructure
core/ui/ docs/en/developer/codebase.md or component-specific user pages

New page checklist (if adding a new doc page):

  1. Create the .md file in docs/en/user/ or docs/en/developer/ with last_updated frontmatter
  2. Register in DocBundleLoader.kt with string resources (in-app browser)
  3. Jekyll and Docusaurus sync pick up new pages automatically — no config change needed

If this PR does not require a doc update (e.g., internal refactor, bug fix, test change), add the skip-docs-check label to dismiss this check.

Cross-platform note: This check is advisory while doc coverage matures. Both Android and Apple repos use the same skip-docs-check label and advisory severity. See meshtastic/design standards for shared conventions.

@jamesarich jamesarich added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit d81a91a Jun 24, 2026
22 checks passed
@jamesarich jamesarich deleted the claude/musing-banzai-87b2d5 branch June 24, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant