Skip to content

Implement remote LNA toggle CLI command#1653

Merged
liamcottle merged 14 commits intomeshcore-dev:devfrom
jbrazio:2026/remote-lna
Mar 16, 2026
Merged

Implement remote LNA toggle CLI command#1653
liamcottle merged 14 commits intomeshcore-dev:devfrom
jbrazio:2026/remote-lna

Conversation

@jbrazio
Copy link
Contributor

@jbrazio jbrazio commented Feb 10, 2026

Refactor of #1164.

This pull request adds support for configuring and persisting RX boosted gain settings for SX12xx series radios (SX1262, SX1268, SX1276) across the codebase. These settings are now stored in preferences, can be set and queried via CLI commands, and are applied during radio initialization.

You might hang a repeater [with a proper antenna] in a difficult to access place to find out that there is a lot of QRM and RX is deaf; most of the situations where I faced this, disabling the Boosted Gain helped a lot with the problem.

When we use small out-of-tune antennas (the ones shipping with the boards) having a boost on the RX helps, this is usually the client situation. For repeater where we usually have proper antennas it's a question of testing with it ON and OFF and check what gives you better performance.

@JDat
Copy link

JDat commented Feb 10, 2026

Idea looks good, but... Can this be done without reconfiguring every platform? Let's say: every board/target have function to control LNA boost and... Depending on platform, LNA boost gain setting is transfered to radio chip. If board/platform/variant not support LNA Boss, it just do noting (empty function). This approach allow to write code without zillion of #define-s

@jbrazio
Copy link
Contributor Author

jbrazio commented Feb 10, 2026

Yeah I know it's a lot of duplicated code but due to the current architecture the requirement of having the function prototypes on target.cpp/h will not go away, having them as empty pointers or adding a conditional macro.. depends on the coding style. And the current coding style is to use conditional macros.

@towerviewcams
Copy link

towerviewcams commented Feb 10, 2026

The boost in the SX12xx board with large amounts of testing does not effect RX sensitivity or noise floor. We tested this allot with the V4 and the LNA bypassed with PCB jump wire. Then set the boost flag on and off on the SX12xx......There was no difference we could find in both quiet and noisy locations. This was for the Sx1262 in the V4.

If someone can really see a difference with this, what board are you using? Our group hasn't been able to duplicate that.

Using the term LNA might confuse people into thinking its the external 17db LNA that cannot be controlled by software. This is what happen in PR1398 at first.

@jbrazio
Copy link
Contributor Author

jbrazio commented Feb 10, 2026

We had a couple of cases with WSL3 and T114 (433 band) in really good city center spots where the TX had a good coverage but RX was just deaf. Uploading a firmware with the LNA off solved the issue.

The ideia is exactly that, put the repeater in a high place and test with and without.. then choose what better works for you.

@towerviewcams
Copy link

Yea, 433, different world for sure and not V4 as expected - different hardware. Cool

@txkbaldlaw
Copy link

I'm looking for this in the RAK 3401/13302 1W booster.

This would be nice, as I have a repeater in a noisy environment, and I think turning off the RX Boost is going to help. I applied it via a compiled firmware to a more accessible repeater, and it improved connectivity. When it put it back to regular FW with RXBoost on, connectivity became less stable. I haven't applied it at the remote site yet, b/c it is difficult to access, but the ability to turn this on or off via a CLI switch remotely would make it easier.

Several people are positing that on the RAK 3401/13302 boosters that deafening is occurring with the boosted RX gain set to on.

…implementations, wire up companion radio

getRxBoostedGain was returned true because both 0x94 (power saving) and
0x96 (boosted gain = 1) return true
@weebl2000
Copy link
Contributor

Please see jbrazio#1

Fix remote LNA toggle bugs: correct register comparison, add missing implementation & wire up companion radio
@jbrazio
Copy link
Contributor Author

jbrazio commented Feb 27, 2026

@ripplebiz Can you review this PR and provide a closure to it ?
Thanks for your time.

@weebl2000
Copy link
Contributor

Build this PR here

Copy link
Contributor

@weebl2000 weebl2000 left a comment

Choose a reason for hiding this comment

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

Thanks for the feature — being able to toggle RX boosted gain at runtime is useful. A few issues to address though.

@jbrazio
Copy link
Contributor Author

jbrazio commented Mar 5, 2026

Thanks for the feature — being able to toggle RX boosted gain at runtime is useful. A few issues to address though.

Thanks for the review.. all your suggestions are valid.
But I will not put any more effort into this PR unless it's clear if it will get merged. This PR + the original one has been dragging since Nov, despite the multiple request for comments from @ripplebiz

@towerviewcams
Copy link

@weebl2000 @jbrazio @IoTThinks I have 5, of the 4.3.1 boards that have left the china warehouse Feb 27th and will be ready to perform testing once they arrive. Arrived at SFO customs this morning.

Happy to help if/when needed. Lets work together to make this happen for everyone.

@terminalvelocity23
Copy link

terminalvelocity23 commented Mar 7, 2026

I'm sorry, what's the CLI command for toggling it on and off? radio.rxgain doesn't work, the repeater doesn't recognize it. I'm running a V4 with 1.14 with this PR merged.

upd: turns out, the USE_SX1262 wasn't defined anywhere for V4, so I've ended up manually adding it.

@txkbaldlaw
Copy link

I'm sorry, what's the CLI command for toggling it on and off? radio.rxgain doesn't work, the repeater doesn't recognize it. I'm running a V4 with 1.14 with this PR merged.

upd: turns out, the USE_SX1262 wasn't defined anywhere for V4, so I've ended up manually adding it.

{get/set} radio.lna {off/on}

@terminalvelocity23
Copy link

{get/set} radio.lna {off/on}

This doesn't work. Look at the code, the command is {get/set} radio.rxgain {off/on}.

@txkbaldlaw
Copy link

{get/set} radio.lna {off/on}

This doesn't work. Look at the code, the command is {get/set} radio.rxgain {off/on}.

Sorry, looks like it got changed somewhere along the way, and I missed it. It was radio.lna in the earlier commits.

Screenshot 2026-03-12 at 11 44 39 AM

@ViezeVingertjes
Copy link
Contributor

upd: turns out, the USE_SX1262 wasn't defined anywhere for V4, so I've ended up manually adding it.

I think this issue isnt resolved yet, right?

@liamcottle
Copy link
Member

Is everyone happy with the state of the PR? I've reviewed the code and looks alright.

From what I can tell this will be usable on repeaters via CLI, but not on companions. The code is there for preferences in the companion firmware, but no way to actually get/set it.

That could probably be added in a follow up PR, otherwise if it's not really needed for companions or no intention to add a way to configure it for companions, we should probably not have the code using up the preference slot if it's not actually configurable.

@weebl2000
Copy link
Contributor

weebl2000 commented Mar 13, 2026

Code looks good, but I'm not sure this feature is actually needed. I think toggling of boosted gain off was mainly helping with deafness of SX1262 which was caused by the AGC not being able to properly reset.

In all my testing boosted gain ON is better as long as the AGC doesn't get stuck, which we have fixed now in 1.14.

If someone has wildly different results with the AGC properly resetting please share.

edit: actually we need to merge this jbrazio#2 first - currently LR1110 won't build.

@JDat
Copy link

JDat commented Mar 13, 2026

Code looks good, but I'm not sure this feature is actually needed. I think toggling of boosted gain off was mainly helping with deafness of SX1262 which was caused by the AGC not being able to properly reset.

In all my testing boosted gain ON is better as long as the AGC doesn't get stuck, which we have fixed now in 1.14.

If someone has wildly different results with the AGC properly resetting please share.

edit: actually we need to merge this jbrazio#2 first - currently LR1110 won't build.

Option to control settings is always better then no option. Don't want to use LNA toggle? Don't touch it! Need to set ON/OFF/Auto (thanks to PR mentioned), do it!

@txkbaldlaw
Copy link

txkbaldlaw commented Mar 13, 2026

I noted significant performance enhancements in the RAK 3401 board in repeater firmware being able to turn it off in certain environments. As mentioned by @JDat above, I'd rather have the option and not use it, rather than having to build a custom FW each time.

@txkbaldlaw
Copy link

txkbaldlaw commented Mar 13, 2026

I noted significant performance enhancements in the RAK 3401 board in repeater firmware being able to turn it off in certain environments. As mentioned by @JDat above, I'd rather have the option and not use it, rather than having to build a custom FW each time.

I rebooted to clear the neighbors list with radio.lna off, advert-ed from other repeaters, snapped a screenshot of the results. Then, issued set radio.lna on, rebooted, and repeated the process. Results below.

It isn't as dramatic today, but at points, it's been a consistent and repeatable 3db shift.

Screenshot 2026-03-13 at 12 43 21 PM Screenshot 2026-03-13 at 12 55 13 PM 1

@jbrazio
Copy link
Contributor Author

jbrazio commented Mar 16, 2026

I don't understand the direction this discussion is heading. This boolean flag is just another tool in the toolbox, no matter the number of tests we do.. I prefer to give people tools that have a real impact on RF and let them decide what best fits their needs.

From what I can tell this will be usable on repeaters via CLI, but not on companions. (..) That could probably be added in a follow up PR

I agree because this needs some coordination with the application side.

I think this issue isnt resolved yet, right?

done.

@weebl2000
Copy link
Contributor

@jbrazio please have a look at merging this jbrazio#2 - it fixes the build for LR1110 devices.

@jbrazio
Copy link
Contributor Author

jbrazio commented Mar 16, 2026

@weebl2000 done

@liamcottle liamcottle merged commit f9250da into meshcore-dev:dev Mar 16, 2026
9 checks passed
@terminalvelocity23
Copy link

Code looks good, but I'm not sure this feature is actually needed. I think toggling of boosted gain off was mainly helping with deafness of SX1262 which was caused by the AGC not being able to properly reset.

In all my testing boosted gain ON is better as long as the AGC doesn't get stuck, which we have fixed now in 1.14.

If someone has wildly different results with the AGC properly resetting please share.

I'm using this feature, it cuts down on the number of bad packets received somewhat. Got a lot of in-band noise from telemetry, and it's useful to have a toggle.

@jbrazio jbrazio deleted the 2026/remote-lna branch March 16, 2026 16:22
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.

8 participants