fix: add missing break in RADIO_SX1280 switch case#306
Merged
G4lile0 merged 1 commit intotinygs:betafrom Mar 17, 2026
Merged
Conversation
The RADIO_SX1280 case was missing a break statement, causing it to fall through to the default case. This overwrote the SX1280 RadioHal with an SX1268 RadioHal, leaked the SX1280 object, and used the wrong radio module. All boards configured for SX1280 (e.g. LilyGo T3S3 2.4GHz) were silently running with an SX1268 driver, which would fail to initialize or behave incorrectly on the 2.4GHz radio hardware.
d407f5c to
d91e998
Compare
Collaborator
|
Thanks for the contribution! Great catch. |
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.
Found a missing
breakin the switch statement inRadio::init()that affects all SX1280 boards.What's happening
The
RADIO_SX1280case falls straight through intodefault, so the SX1280 RadioHal gets created and then immediately overwritten by an SX1268 one:So any board set up for SX1280 (like the LilyGo T3S3 2.4GHz) ends up running the SX1268 driver instead, which either fails to init or just doesn't work right. The SX1280 object also leaks since nothing ever frees it.
The fix
Just added the missing
break;— same as every other case in the switch already has.case RADIO_SX1280: radioHal = new RadioHal<SX1280>(...); moduleNameString="SX1280"; + break; default:Probably the root cause (or at least part of it) for #280.