Skip to content

Unify code for setting link parameters from UI - #3472

Merged
CapnBry merged 3 commits into
ExpressLRS:masterfrom
CapnBry:unify-txconfset
Jan 4, 2026
Merged

CapnBry merged 3 commits into
ExpressLRS:masterfrom
CapnBry:unify-txconfset

Conversation

@CapnBry

@CapnBry CapnBry commented Dec 31, 2025 •

Copy link
Copy Markdown
Member

Unifies the UI -> config setting code between screen devices and lua for Packet Rate, Antenna Mode, Switch Mode, and TLM Ratio. Logic not being copy pasted between the two had lead to different behaviors and broken telemetry in X-Band modes.

Fixes #3471. To reproduce this bug, the Antenna mode has to not be set to Gemini before switching the Band to an X mode. The antenna mode stays in not-Gemini, and the telemetry receiver can't reassemble the data properly because only one of the two radios' data is used,

Details

The real problem identified in #3471 is that setting the Band to X-Band in the lua simply sets the packet rate to X150 and calls it a day. For telemetry to work properly in any Gemini mode (of which X150 is), the antenna mode must be forced to Gemini, and the Band lua item skipped that check.

The Packet Rate lua item also was missing the check, but the screen's Packet Rate setter included it. The lua version of this parameter also included logic restricting changes in Mavlink mode, but the screen's version did not.

Fix

To resolve this, I have unified the setting of the packet rate from the UI so that all methods (automatic on band switch, lua set, screen set) call the same function. There may be additional logic needed for linkMode == MAVLINK to adjust the switch mode to be appropriate on band change.

And then I did the other setters, most of which matched their duplicate implementations!

@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.

Looks good. I'm just not sure about these extra tx_* global functions.
Something for future us to think about I suppose.

@CapnBry

CapnBry commented Dec 31, 2025 •

Copy link
Copy Markdown
Member Author

Yeah I was pretty unhappy with that myself. I've pushed a slightly different design where the screen just calls the crsfTransmitter directly, seems like a better design to me?

EDIT: Also moved SetMaxPower and SetDynamicPower to shared implementations. All this sharing has reduced code size 240 bytes too!

@pkendall64

Copy link
Copy Markdown
Collaborator

Nice. I'm cool with that.

@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.

Fixes #3471 confirmed

All tested combinations of Bands/Antenna modes/packet worked fine.

@CapnBry
CapnBry merged commit 2800f63 into ExpressLRS:master Jan 4, 2026
@CapnBry
CapnBry deleted the unify-txconfset branch February 8, 2026 20:11
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.

missing flight controller telemetry with gemx enabled

3 participants