Skip to content

Conversation

@jamesarich
Copy link
Collaborator

@jamesarich jamesarich commented Jan 5, 2026

This commit introduces several new regions and corresponding modem presets to align with recent firmware updates.

  • Adds EU_866, NARROW_868, and HAM_US433 regions.
  • Adds new modem presets: LITE_FAST, LITE_SLOW, NARROW_FAST, and NARROW_SLOW.
  • Updates the channel calculation logic to account for channel spacing, matching the firmware's behavior.
  • Sets the default modem preset automatically when a new region is selected.
  • Updates the protobuf submodule to tom's proposed version.

This is mostly for @NomDeTom to test his proposed changes.

@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (833f1ca) to head (c3be3f2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4135   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          3       3           
  Lines         23      23           
  Branches       7       7           
=====================================
  Misses        23      23           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added enhancement New feature or request help wanted Extra attention is needed labels Jan 5, 2026
This commit introduces several new regions and corresponding modem presets to align with recent firmware updates.

-   Adds `EU_866`, `NARROW_868`, and `HAM_US433` regions.
-   Adds new modem presets: `LITE_FAST`, `LITE_SLOW`, `NARROW_FAST`, and `NARROW_SLOW`.
-   Updates the channel calculation logic to account for channel spacing, matching the firmware's behavior.
-   Sets the default modem preset automatically when a new region is selected.
-   Updates the protobuf submodule to the latest version.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Correct the `numChannels` and `radioFreq` calculations to align with the firmware logic. This primarily affects the NARROW_868 region by properly accounting for channel spacing.

- Remove `regionInfo.spacing` from the `numChannels` numerator.
- Add `regionInfo.spacing` to the `radioFreq` calculation.
- Add tests to verify `numChannels` and `radioFreq` for the `NARROW_868` region.
// Firmware: channel_num = hash(channelName) % numChannels;
// freq = myRegion->freqStart + myRegion->spacing + (bw / 2000) + (channel_num * channelSpacing);
// The app's channelNum function returns 1..numChannels if channelNum is 0.
(regionInfo.freqStart + regionInfo.spacing + bw / 2) + (channelNum - 1) * channelSpacing

Choose a reason for hiding this comment

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

Should be
(regionInfo.freqStart + (bw / 2)) + ((channelNum - 1) * channelSpacing)

(regionInfo.freqStart + bandwidth(regionInfo) / 2) + (channelNum - 1) * bandwidth(regionInfo)
val bw = bandwidth(regionInfo)
val channelSpacing = regionInfo.spacing + bw
// Match firmware: float freq = myRegion->freqStart + myRegion->spacing + (bw / 2000) + (channel_num *

Choose a reason for hiding this comment

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

Firmware line is float freq = myRegion->freqStart + (bw / 2000) + (channel_num * channelSpacing);

),

/** US 433MHz Amateur Use band */
HAM_US433(

Choose a reason for hiding this comment

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

This has been taken out for now. Will come back to it after non-ham is sorted

The frequency calculation for amateur radio regions was incorrectly including `regionInfo.spacing`. This change removes the spacing component from the calculation when the region description contains "Amateur", aligning the behavior with the firmware.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants