Lora region preset map#10736
Merged
Merged
Conversation
Contributor
⚡ Try this PR in the Web FlasherWarning This is an automated, unreviewed CI test build. Back up your device configuration Supported boards built by this PR (24)
Build artifacts expire on 2026-07-17. Updated for |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new “LoRa region ↔ modem preset compatibility map” to the config handshake so clients can prevent users from choosing illegal region+preset combinations (and can surface “licensed-only” bands), improving UX and regulatory compliance.
Changes:
- Extends the protobuf/API with
FromRadio.region_presets(field 19) and supporting messages to efficiently encode region→preset-group constraints. - Implements
getRegionPresetMap()to generate a grouped region→preset map from the firmware region table and sends it duringwant_config(after metadata, before channels). - Adds unit tests validating coverage and correctness of the advertised map against the live region table.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
test/test_radio/test_main.cpp |
Adds tests for getRegionPresetMap() coverage, bounds, and consistency with the region table. |
src/mesh/RadioInterface.cpp |
Implements getRegionPresetMap() by coalescing regions into preset groups. |
src/mesh/PhoneAPI.h |
Adds a new handshake state STATE_SEND_REGION_PRESETS. |
src/mesh/PhoneAPI.cpp |
Sends FromRadio.region_presets during the config handshake after metadata. |
src/mesh/MeshRadio.h |
Declares getRegionPresetMap() for use by PhoneAPI and tests. |
src/mesh/generated/meshtastic/mesh.pb.h |
Adds generated structs/fields for the new protobuf messages and FromRadio oneof variant. |
src/mesh/generated/meshtastic/mesh.pb.cpp |
Registers/binds the new protobuf message descriptors. |
docs/lora_region_preset_compatibility_client_spec.md |
Adds client-facing spec describing delivery timing and decoding/UX rules. |
- Log (and break/skip) when the region preset map exceeds its array bounds instead of silently dropping regions - Derive test bounds from the generated nanopb array sizes via sizeof() instead of hard-coded magic numbers - Fix want_config sequence comment (missing comma, STATE_SEND_MODULECONFIG) - Specify a language on the spec's fenced code blocks (markdownlint MD040)
Contributor
Firmware Size Report22 targets | vs
Show 17 more target(s)
Updated for 73ec1bc |
…available()
available() had a separate per-state switch that wasn't updated for the new
state, so it returned false ('unexpected state 5') and getFromRadio() was
never called - the config handshake stalled after metadata and the client
timed out. Verified via the native simulator integration test.
raghumad
pushed a commit
to raghumad/mezulla-firmware
that referenced
this pull request
Jun 25, 2026
* Added lora region and preset maps
* Protos
* Address PR review feedback
- Log (and break/skip) when the region preset map exceeds its array bounds
instead of silently dropping regions
- Derive test bounds from the generated nanopb array sizes via sizeof()
instead of hard-coded magic numbers
- Fix want_config sequence comment (missing comma, STATE_SEND_MODULECONFIG)
- Specify a language on the spec's fenced code blocks (markdownlint MD040)
* Fix want_config stall: handle STATE_SEND_REGION_PRESETS in PhoneAPI::available()
available() had a separate per-state switch that wasn't updated for the new
state, so it returned false ('unexpected state 5') and getFromRadio() was
never called - the config handshake stalled after metadata and the client
timed out. Verified via the native simulator integration test.
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.
This pull request introduces a new feature that allows the firmware to communicate the legal combinations of LoRa regions and modem presets to clients during the configuration handshake. This enables client UIs to prevent users from selecting illegal region+preset combinations, improving user experience and regulatory compliance. The implementation includes protocol extensions, firmware-side logic to generate the compatibility map, integration into the configuration handshake, and comprehensive unit tests.
LoRa Region–Preset Compatibility Feature
Protocol and API Additions:
region_presetsfield (field 19) to theFromRadiomessage in the protobufs, along with supporting messages (LoRaRegionPresetMap,LoRaPresetGroup, andLoRaRegionPresets) to describe legal region→preset groupings. This enables efficient transmission of compatibility data to clients. [1] [2]Firmware Implementation:
getRegionPresetMap()function inMeshRadio.h/RadioInterface.cppto generate the grouped region→preset compatibility map, coalescing regions that share identical preset lists and licensing requirements. [1] [2]PhoneAPI.cpp, sending it to clients after metadata and before channel configuration. This ensures clients receive the map as part of the standard config flow. [1] [2] [3] [4]Testing and Validation:
test_radio/test_main.cppto verify that all known regions are covered, the map stays within protocol bounds, and the advertised presets and licensing flags match the firmware's region table.Documentation:
docs/lora_region_preset_compatibility_client_spec.md) detailing the protocol changes, client handling rules, decoding logic, UI/UX recommendations, and platform-specific notes for Android, Apple, Python, and web clients.