Skip to content

fix: add missing break in RADIO_SX1280 switch case#306

Merged
G4lile0 merged 1 commit intotinygs:betafrom
killerdevildog:fix/sx1280-switch-fallthrough
Mar 17, 2026
Merged

fix: add missing break in RADIO_SX1280 switch case#306
G4lile0 merged 1 commit intotinygs:betafrom
killerdevildog:fix/sx1280-switch-fallthrough

Conversation

@killerdevildog
Copy link
Copy Markdown
Contributor

Found a missing break in the switch statement in Radio::init() that affects all SX1280 boards.

What's happening

The RADIO_SX1280 case falls straight through into default, so the SX1280 RadioHal gets created and then immediately overwritten by an SX1268 one:

case RADIO_SX1280:
    radioHal = new RadioHal<SX1280>(...);
    moduleNameString="SX1280";
    // no break here!
default:
    radioHal = new RadioHal<SX1268>(...);
    moduleNameString="default SX1268";

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.

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.
@killerdevildog killerdevildog force-pushed the fix/sx1280-switch-fallthrough branch from d407f5c to d91e998 Compare March 17, 2026 01:32
@G4lile0 G4lile0 changed the base branch from master to beta March 17, 2026 22:10
@G4lile0 G4lile0 merged commit 3097bff into tinygs:beta Mar 17, 2026
@G4lile0
Copy link
Copy Markdown
Collaborator

G4lile0 commented Mar 17, 2026

Thanks for the contribution! Great catch.
I’m going to merge this into G4lile0:beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants