Move overrideSlot from RegionProfile to RegionInfo (override per-region)#10560
Open
vidplace7 wants to merge 1 commit into
Open
Move overrideSlot from RegionProfile to RegionInfo (override per-region)#10560vidplace7 wants to merge 1 commit into
vidplace7 wants to merge 1 commit into
Conversation
Move default frequency (slot) override from RegionProfile to RegionInfo (set per-region). This is usually set to `0`, but will be especially useful for Ham modes where each region default must fit within a band plan. Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors radio region configuration so the frequency “override slot” is defined per-region (RegionInfo) rather than per-profile (RegionProfile), enabling region-specific defaults even when regions share the same regulatory/preset profile.
Changes:
- Moves
overrideSlotfromRegionProfiletoRegionInfoand updates region definitions/macros accordingly. - Updates
RadioInterfacelogic to read the override slot from the selected region rather than the shared profile. - Adjusts admin-radio unit tests to reflect the new struct layout and override-slot source.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/mesh/MeshRadio.h |
Moves overrideSlot to RegionInfo and updates related comments/constants. |
src/mesh/RadioInterface.cpp |
Updates region table construction (RDEF) and runtime slot-selection/clamping logic to use RegionInfo::overrideSlot. |
test/test_admin_radio/test_main.cpp |
Updates test-region definitions and assertions to validate RegionInfo::overrideSlot. |
| } else if (newRegion->overrideSlot > 0) { // clamp to explicit override slot | ||
| loraConfig.channel_num = | ||
| newRegion->profile->overrideSlot; // use the explicit override slot specified by the region profile | ||
| newRegion->overrideSlot; // use the explicit override slot specified by the region profile |
| TEST_ASSERT_EQUAL(OVERRIDE_SLOT_PRESET_HASH, TEST_PROFILE_PRESET_HASH.overrideSlot); | ||
| TEST_ASSERT_EQUAL(-1, TEST_PROFILE_PRESET_HASH.overrideSlot); | ||
| TEST_ASSERT_EQUAL(OVERRIDE_SLOT_PRESET_HASH, TEST_REGION_PRESET_HASH.overrideSlot); | ||
| TEST_ASSERT_EQUAL(-1, TEST_REGION_PRESET_HASH.overrideSlot); |
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.
Move default frequency (slot) override from RegionProfile to RegionInfo (set per-region).
This is usually set to
0, but will be especially useful for Ham modes where each region default must fit within a band plan.🤖 AI Summary:
This pull request refactors how the frequency override slot is handled in the radio configuration code. The main change is moving the
overrideSlotfield from theRegionProfilestruct to theRegionInfostruct, making region-specific frequency overrides more explicit and easier to manage. All related logic and initializations have been updated to reflect this new structure, and the test code has been adjusted accordingly.Key changes:
Refactoring of frequency override slot handling:
overrideSlotfield fromRegionProfiletoRegionInfo, making it a region-specific property rather than a profile-wide one. All logic and comments referencingRegionProfile::overrideSlothave been updated to useRegionInfo::overrideSlotinstead. [1] [2] [3]RegionProfileinitializations inRadioInterface.cppand removed theoverrideSlotparameter from their definitions.RDEFmacro and allRegionInfoinitializations to include the newoverrideSlotparameter, defaulting to0for all regions exceptEU_N_868, which uses1. [1] [2] [3] [4]Logic and code updates:
RadioInterface.cppthat previously accessedoverrideSlotviaprofileto use the newoverrideSlotfield directly fromRegionInfo. This includes checks, assignments, and logging related to frequency slot selection. [1] [2] [3] [4]Test updates:
overrideSlotfield from all testRegionProfiledefinitions intest_main.cppto match the new struct definition. [1] [2] [3] [4]