-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(radio): validate 2.4 GHz bandwidths #11317
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: develop
Are you sure you want to change the base?
Changes from all commits
e57ebb0
e884072
74c86dc
3d169c9
8d478f8
b6d2ed2
88e643e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,6 +200,27 @@ static inline uint16_t clampBandwidthCode(uint16_t bwCode) | |
| return bwCode; | ||
| } | ||
|
|
||
| static inline bool supportsSx128xLoRaBandwidth(float bandwidthKHz, bool wideBand) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the |
||
| { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole section looks like an anti-pattern to the rest of the file, or at least a horrible typo trap, even for an llm |
||
| return wideBand && (bandwidthKHz == 203.125f || bandwidthKHz == 406.25f || bandwidthKHz == 812.5f || bandwidthKHz == 1625.0f); | ||
| } | ||
|
|
||
| static inline bool supportsLr11x0LoRaBandwidth(float bandwidthKHz, bool wideBand) | ||
| { | ||
| if (wideBand) | ||
| return bandwidthKHz == 203.125f || bandwidthKHz == 406.25f || bandwidthKHz == 812.5f; | ||
|
|
||
| return bandwidthKHz == 62.5f || bandwidthKHz == 125.0f || bandwidthKHz == 250.0f || bandwidthKHz == 500.0f; | ||
| } | ||
|
|
||
| static inline bool supportsLr20x0LoRaBandwidth(float bandwidthKHz, bool wideBand) | ||
| { | ||
| (void)wideBand; | ||
| return bandwidthKHz == 31.25f || bandwidthKHz == 41.7f || bandwidthKHz == 62.5f || bandwidthKHz == 83.0f || | ||
| bandwidthKHz == 101.0f || bandwidthKHz == 125.0f || bandwidthKHz == 203.125f || bandwidthKHz == 250.0f || | ||
| bandwidthKHz == 406.25f || bandwidthKHz == 500.0f || bandwidthKHz == 812.5f || bandwidthKHz == 1000.0f; | ||
| } | ||
|
|
||
| static inline void modemPresetToParams(meshtastic_Config_LoRaConfig_ModemPreset preset, bool wideLora, float &bwKHz, uint8_t &sf, | ||
| uint8_t &cr) | ||
| { | ||
|
|
@@ -294,4 +315,4 @@ static inline float modemPresetToBwKHz(meshtastic_Config_LoRaConfig_ModemPreset | |
| uint8_t cr = 0; | ||
| modemPresetToParams(preset, wideLora, bwKHz, sf, cr); | ||
| return bwKHz; | ||
| } | ||
| } | ||
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.
Success bool may be false. What's the cost of a descriptive result?