-
-
Notifications
You must be signed in to change notification settings - Fork 381
feat: Add new regions and modem presets #4135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
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>
3b7afbd to
9602fe7
Compare
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.
9602fe7 to
0724924
Compare
| // 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 |
There was a problem hiding this comment.
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 * |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
This commit introduces several new regions and corresponding modem presets to align with recent firmware updates.
EU_866,NARROW_868, andHAM_US433regions.LITE_FAST,LITE_SLOW,NARROW_FAST, andNARROW_SLOW.This is mostly for @NomDeTom to test his proposed changes.