feat(lora): warn when selecting a licensed amateur-radio region (#3924)#3930
Merged
Conversation
Adds a compliance warning to the LoRa configuration UI (both the device Configuration tab and the Remote Admin radio-config panel) when the selected RegionCode is one of the ITU 2m amateur-radio bands (ITU1_2M=27, ITU23_2M=28). Operating on these regions legally requires a valid amateur radio license, so the banner reminds the operator of their compliance responsibility — mirroring the amateur-band warning in the official Meshtastic mobile apps. New `isAmateurRadioRegion()` helper + `AMATEUR_RADIO_REGIONS` map in configuration/constants.ts, unit-tested in LoRaConfigSection.test.tsx. Note: firmware 2.8's region->preset legality map (used by the mobile apps to filter the preset picker) cannot be consumed yet because the vendored protobufs are at v2.7.26 and predate it. Per-preset legality filtering is deferred until the protobuf submodule is bumped to a 2.8 release; the helper's doc comment records the follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n
|
Claude finished @Yeraze's task —— View job PR Review: feat(lora): warn when selecting a licensed amateur-radio regionTasks:
Code ReviewThis is a clean, well-scoped implementation. The PR does exactly what it says and nothing more. Here's a breakdown: constants.tsStrengths:
Minor observations:
LoRaConfigSection.tsxStrengths:
Observations:
RadioConfigurationSection.tsxStrengths:
Pre-existing issues (not introduced by this PR):
LoRaConfigSection.test.tsxStrengths:
Observation:
en.jsonStrengths:
Minor suggestion:
SummaryThis PR is ready to merge. The implementation is correct, well-tested, and appropriately scoped. The advisory-only approach (no save blocking) is the right call given the absent firmware legality map. The one minor inconsistency (missing CSS variable fallback in The two items worth noting as follow-ups (not blocking):
|
Yeraze
added a commit
that referenced
this pull request
Jul 5, 2026
…t 1) (#3936) * feat(config): filter LoRa modem presets by region legality (#3924) Part 1 of #3924 (Part 2, the amateur-radio advisory warning, merged in #3930). Mirrors the official Meshtastic mobile apps by filtering the modem- preset picker to presets that are legal for the selected LoRa region. There is NO protobuf wire field carrying a region -> preset legality map; it never landed at any 2.8.x tag (verified against meshtastic/protobufs config.proto — Config.LoRaConfig only exposes region + modem_preset). The apps replicate a firmware-side computation locally: a preset is legal for a region iff (freqEnd - freqStart) >= presetBandwidthKHz/1000. This replicates that table + math as a local constant (no protobuf submodule bump needed). - constants.ts: add REGION_FREQ_INFO (from firmware RadioInterface.cpp regions[]), PRESET_BANDWIDTH_KHZ (from MeshRadio.h modemPresetToParams), and getPresetBandwidthKHz / isPresetLegalForRegion / getLegalPresetOptions helpers. Correct the stale comment that claimed a 2.8 wire map exists. - LoRaConfigSection.tsx + RadioConfigurationSection.tsx: filter the preset picker via getLegalPresetOptions(region, modemPreset), always retaining the current selection, plus a note when presets are hidden. - en.json: add lora_config.preset_filtered_note. - constants.test.ts: cover bandwidth lookup, per-region legality (EU_868 rejects the 500 kHz presets, RU allows them, wide bands allow all, unknown regions permissive), and option filtering. In practice only EU_868 (0.25 MHz span) filters anything today, rejecting the two 500 kHz presets (SHORT_TURBO, LONG_TURBO). Complements the #3930 warning. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n * fix(lora): epsilon-guard preset legality float compare Address review on #3936: use `spanMHz >= bandwidthMHz - 1e-9` so IEEE-754 subtraction (e.g. 869.2 - 868.7) can't mis-exclude a preset whose bandwidth lands exactly on a region's span. No behavior change for current region values. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n --------- 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.
Closes #3924
Summary
Issue #3924 asks MeshMonitor to warn on illegal LoRa preset/region combinations, mirroring firmware 2.8 / the official mobile apps. The full behavior the issue describes has two parts:
mesh.proto, "Sent once" by the device). The vendored protobuf submodule is currently v2.7.26, which predates that map, so there is no wire message to consume yet. This part is deferred until the protobuf submodule is bumped to a 2.8 release.ITU1_2M= 27,ITU23_2M= 28) map onto the 2m amateur band (144–148 MHz), which is licensed amateur spectrum in every ITU region.What changed
configuration/constants.ts: newAMATEUR_RADIO_REGIONSmap +isAmateurRadioRegion()helper (null/undefined-safe). Doc comment records the firmware-2.8 legality-map follow-up.LoRaConfigSection.tsx(device Configuration tab): shows arole="alert"warning banner beneath the Region selector when an amateur band is selected.RadioConfigurationSection.tsx(Remote Admin radio config): same warning banner for parity.public/locales/en.json: newlora_config.amateur_band_warningstring (other locales fall back to English via Weblate).LoRaConfigSection.test.tsx: 6 new unit tests forisAmateurRadioRegion(positive ITU cases, negative ISM/SRD/UNSET/out-of-range cases, null/undefined handling, and REGION_MAP sync).The warning is advisory only — it does not block saving, matching the non-blocking nature of the mobile-app behavior and avoiding false positives while the firmware legality map is unavailable.
Testing
npm run build: passes.eslinton changed files: 0 errors (3 pre-existinganywarnings on untouched prop types).Follow-up
When the protobuf submodule is bumped to a firmware-2.8 release, the static
AMATEUR_RADIO_REGIONSlist can be replaced/augmented by the device-reported region→preset legality map to also filter the modem-preset picker and auto-switch to the region default, completing the rest of #3924.🤖 Generated with Claude Code
https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n