Skip to content

Do not switch RX rate if RX cant do rate from SYNC packet - #3610

Merged
pkendall64 merged 1 commit into
ExpressLRS:masterfrom
CapnBry:invalid-rateswitch
Apr 23, 2026
Merged

pkendall64 merged 1 commit into
ExpressLRS:masterfrom
CapnBry:invalid-rateswitch

Conversation

@CapnBry

@CapnBry CapnBry commented Apr 15, 2026

Copy link
Copy Markdown
Member

Changes SYNC behavior to prevent a receiver from switching to a Packet Rate it can't do. Currently it will always soft-brick the receiver, and this PR changes the behavior to just not switch at all.

This was discovered during like 4.0.0-RC4 but everything was so stable I didn't want to throw in all these changes to an interrupt function and possibly breaking something for a relatively minor fix.

Steps to Reproduce

  1. Get an LR1121 TX and a SX1280 RX, or SX1280 TX and LR1121 TX
  2. Establish a connection on a rate that is common to both, e.g. 500Hz LoRa 2G4
  3. Switch the TX to a rate not supported by the RX
  • For LR1121 TX, switch to e.g. DK500
  • For SX1280 TX, switch to e.g. F500
  1. The RX will disconnect but not connect at the new rate, as expected because it can not support the required modulation
  2. Switch the TX back to the previous rate, the RX will not connect at this rate either, because it actually switched to a different completely unsupported rate and the RX will now need to be rebooted.

Details

When the receiver receives a SYNC packet for a rate that isn't in its ModParams table, it instead selects index 0. For LR1121 receivers this will be SubGHz FSK K1000 Full, which SX1280 transmitters can not do. For SX1280 receivers this will be F1000 FLRC, which LR1121 transmitters can not do.

This is mitigated on single band LR1121 receivers, as there was code to prevent it from switching to K1000 Full due to it not being supported (even though this wasn't the mode the transmitter requested), so it tries to bounce back to the previous rate and usually can do so. However, all the other parameters from the SYNC packet will be accepted anyway, meaning the switch mode could flip unintentionally, or the serial output mode might change as well which could also be unrecoverable.

The issue is that enumRatetoIndex() is always is expected to return a valid Index into the ModParams table, even if the rate isn't supported. They SYNC packet tries to find the unsupported rate, it instead returns index 0 which is valid, and the receiver is now locked itself in a room and won't come out.

Solution

Use a different function to see if the rate is in the ModParams table first, and also verify that the rate is supported by the frontend hardware-- ignoring the entire sync packet entirely if both of these aren't true. The receiver stays at the old rate and disconnects, but the transmitter can still go back to the previous rate to reconnect.

@pkendall64 pkendall64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Much better user experience, thanks @CapnBry

@mha1 mha1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good. Tested this in a mixed PR on RX and master on TX setup (Nomad/SuperP). Looks good. I can step through all supported rates. When selecting a non-supported rate the RX disconnects and will (only) connect again if the supported rate it was previously connected to is selected again.

@pkendall64
pkendall64 merged commit 6141f92 into ExpressLRS:master Apr 23, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants