Skip to content

Move overrideSlot from RegionProfile to RegionInfo (override per-region)#10560

Open
vidplace7 wants to merge 1 commit into
developfrom
migrate-overrideslot
Open

Move overrideSlot from RegionProfile to RegionInfo (override per-region)#10560
vidplace7 wants to merge 1 commit into
developfrom
migrate-overrideslot

Conversation

@vidplace7
Copy link
Copy Markdown
Member

@vidplace7 vidplace7 commented May 27, 2026

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 overrideSlot field from the RegionProfile struct to the RegionInfo struct, 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:

  • Moved the overrideSlot field from RegionProfile to RegionInfo, making it a region-specific property rather than a profile-wide one. All logic and comments referencing RegionProfile::overrideSlot have been updated to use RegionInfo::overrideSlot instead. [1] [2] [3]
  • Updated the RegionProfile initializations in RadioInterface.cpp and removed the overrideSlot parameter from their definitions.
  • Modified the RDEF macro and all RegionInfo initializations to include the new overrideSlot parameter, defaulting to 0 for all regions except EU_N_868, which uses 1. [1] [2] [3] [4]

Logic and code updates:

  • Updated all logic in RadioInterface.cpp that previously accessed overrideSlot via profile to use the new overrideSlot field directly from RegionInfo. This includes checks, assignments, and logging related to frequency slot selection. [1] [2] [3] [4]

Test updates:

  • Removed the overrideSlot field from all test RegionProfile definitions in test_main.cpp to match the new struct definition. [1] [2] [3] [4]

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>
@vidplace7 vidplace7 requested review from NomDeTom and Copilot May 27, 2026 01:26
@vidplace7 vidplace7 added the enhancement New feature or request label May 27, 2026
@github-actions github-actions Bot added the needs-review Needs human review label May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 overrideSlot from RegionProfile to RegionInfo and updates region definitions/macros accordingly.
  • Updates RadioInterface logic 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);
@vidplace7 vidplace7 marked this pull request as ready for review May 27, 2026 01:56
@vidplace7 vidplace7 requested review from caveman99 and thebentern May 27, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants