From 885926148ad7dc679f2a11bc8535d6f7be74a29e Mon Sep 17 00:00:00 2001 From: Olexandr Tyshchenko Date: Tue, 17 Nov 2026 23:46:53 +0200 Subject: [PATCH] Honour RX_BOOSTED_GAIN default on non-SX126x radios The rx_boosted_gain default was only set for USE_SX1262/USE_SX1268, so on LR1110/LR1121/LR2021 boards it stayed 0. begin() then applied it to the radio, turning off the boosted gain that the variant had just enabled in target.cpp via RX_BOOSTED_GAIN (or LR2021_RX_BOOSTED_GAIN in CustomLR2021::std_init()). Use those flags as the default for the other radios in the repeater, companion and room server. SX1262/SX1268 and radios without either flag are unchanged. --- examples/companion_radio/MyMesh.cpp | 4 ++++ examples/simple_repeater/MyMesh.cpp | 4 ++++ examples/simple_room_server/MyMesh.cpp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index cd6966e8a6b..ff18f731ea5 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -939,6 +939,10 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe #else _prefs.rx_boosted_gain = 1; // enabled by default #endif +#elif defined(RX_BOOSTED_GAIN) + _prefs.rx_boosted_gain = RX_BOOSTED_GAIN ? 1 : 0; // other radios: keep the variant default +#elif defined(LR2021_RX_BOOSTED_GAIN) + _prefs.rx_boosted_gain = LR2021_RX_BOOSTED_GAIN ? 1 : 0; #endif } diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 21f833a588d..ec6b8c062ed 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -933,6 +933,10 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc #else _prefs.rx_boosted_gain = 1; // enabled by default; #endif +#elif defined(RX_BOOSTED_GAIN) + _prefs.rx_boosted_gain = RX_BOOSTED_GAIN ? 1 : 0; // other radios: keep the variant default +#elif defined(LR2021_RX_BOOSTED_GAIN) + _prefs.rx_boosted_gain = LR2021_RX_BOOSTED_GAIN ? 1 : 0; #endif _prefs.radio_fem_rxgain = 1; _prefs.radio_fem_txgain = 0; diff --git a/examples/simple_room_server/MyMesh.cpp b/examples/simple_room_server/MyMesh.cpp index c1a6b09ff07..2e4ff3c650d 100644 --- a/examples/simple_room_server/MyMesh.cpp +++ b/examples/simple_room_server/MyMesh.cpp @@ -682,6 +682,10 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc #else _prefs.rx_boosted_gain = 1; // enabled by default; #endif +#elif defined(RX_BOOSTED_GAIN) + _prefs.rx_boosted_gain = RX_BOOSTED_GAIN ? 1 : 0; // other radios: keep the variant default +#elif defined(LR2021_RX_BOOSTED_GAIN) + _prefs.rx_boosted_gain = LR2021_RX_BOOSTED_GAIN ? 1 : 0; #endif _prefs.radio_fem_rxgain = 1; _prefs.radio_fem_txgain = 0;