From b3c638842e75f7904476b7f47ca53434c851ce08 Mon Sep 17 00:00:00 2001 From: Tesso M Costa Date: Tue, 7 Jul 2026 15:50:07 -0600 Subject: [PATCH] pager: fix LR1121 TX power default and RX-boosted-gain gating Boot TX power was left at a conservative 10dBm (Heltec V4's pattern) with no way to raise it, unlike the T-Deck which boots straight at the chip's real 22dBm ceiling. On hardware this was silently degrading outbound range: adverts/DMs sent from the pager were unreliable while inbound reception was fine, since the far node's own TX power was unaffected. 22dBm is confirmed as this chip's actual sub-GHz HP-PA ceiling via RadioLib's LR1120::checkOutputPower() (LR1121 inherits it) and matches trail-mate's own working config for this board. Also widen the three RX-boosted-gain gates in MyMesh.cpp/DataStore.cpp that only checked USE_SX1262/USE_SX1268 to include USE_LR1121 -- CustomLR1121Wrapper already implements setRxBoostedGainMode/ getRxBoostedGainMode, so the setting was silently a no-op for this radio. Signed-off-by: Tesso M Costa --- platformio.ini | 14 +++++++++++--- src/DataStore.cpp | 2 +- src/MyMesh.cpp | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index ab0f45e..372d704 100644 --- a/platformio.ini +++ b/platformio.ini @@ -426,9 +426,17 @@ build_flags = -D USE_LR1121=1 -D RADIO_CLASS=CustomLR1121 -D WRAPPER_CLASS=CustomLR1121Wrapper - ; Conservative boot default (matches Heltec V4's default and trail-mate's own - ; fallback) -- real RF power tuning happens on hardware in a later milestone. - -D LORA_TX_POWER=10 + ; Full sub-GHz HP-PA power on boot, matching the T-Deck's own LORA_TX_POWER=22 + ; (not Heltec V4's conservative-10-then-raise-in-Settings pattern). +22dBm is + ; this chip's real ceiling for freq < 1GHz -- confirmed against RadioLib's + ; pinned LR1120::checkOutputPower() (LR1121 inherits it: HP PA auto-selects + ; above 14dBm, valid range -9..22) and trail-mate's own + ; TRAIL_MATE_LORA_TX_POWER_MAX_DBM=22 for this exact board -- not a guess + ; carried over from the sibling boards. A weak default here (10dBm, ~16x less + ; power) was silently degrading outbound range on real hardware: adverts/DMs + ; sent FROM the pager were unreliable while inbound reception was fine, since + ; the far node's own TX was unaffected. + -D LORA_TX_POWER=22 -D P_LORA_DIO_1=14 -D P_LORA_NSS=36 -D P_LORA_RESET=47 diff --git a/src/DataStore.cpp b/src/DataStore.cpp index a3ee0b0..cbf8307 100644 --- a/src/DataStore.cpp +++ b/src/DataStore.cpp @@ -261,7 +261,7 @@ void DataStore::loadPrefs(NodePrefs& prefs, double& node_lat, double& node_lon) namespace { void default_rx_boosted_gain_pref(uint8_t& out) { -#if defined(USE_SX1262) || defined(USE_SX1268) || defined(SX126X_RX_BOOSTED_GAIN) +#if defined(USE_SX1262) || defined(USE_SX1268) || defined(USE_LR1121) || defined(SX126X_RX_BOOSTED_GAIN) #ifdef SX126X_RX_BOOSTED_GAIN out = (SX126X_RX_BOOSTED_GAIN != 0) ? 1 : 0; #else diff --git a/src/MyMesh.cpp b/src/MyMesh.cpp index a9e398d..c586d5d 100644 --- a/src/MyMesh.cpp +++ b/src/MyMesh.cpp @@ -2537,7 +2537,7 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe _prefs.gps_enabled = 0; // GPS disabled by default _prefs.gps_interval = 0; // No automatic GPS updates by default //_prefs.rx_delay_base = 10.0f; enable once new algo fixed -#if defined(USE_SX1262) || defined(USE_SX1268) +#if defined(USE_SX1262) || defined(USE_SX1268) || defined(USE_LR1121) #ifdef SX126X_RX_BOOSTED_GAIN _prefs.rx_boosted_gain = SX126X_RX_BOOSTED_GAIN ? 1 : 0; #else @@ -2553,7 +2553,7 @@ void MyMesh::applyRadioFromPrefs() { radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr); radio_driver.radioRelease(); radio_driver.setTxPower(_prefs.tx_power_dbm); -#if defined(USE_SX1262) || defined(USE_SX1268) +#if defined(USE_SX1262) || defined(USE_SX1268) || defined(USE_LR1121) _prefs.rx_boosted_gain = _prefs.rx_boosted_gain ? 1 : 0; radio_driver.setRxBoostedGainMode(_prefs.rx_boosted_gain != 0); MESH_DEBUG_PRINTLN("RX Boosted Gain Mode: %s", @@ -3352,7 +3352,7 @@ void MyMesh::handleCmdFrame(size_t len) { radio_driver.radioAcquire(); // hold off the RX drain task mid-sequence (no-op when off) radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr); -#if defined(USE_SX1262) || defined(USE_SX1268) || defined(SX126X_RX_BOOSTED_GAIN) +#if defined(USE_SX1262) || defined(USE_SX1268) || defined(USE_LR1121) || defined(SX126X_RX_BOOSTED_GAIN) radio_driver.setRxBoostedGainMode(_prefs.rx_boosted_gain != 0); #endif radio_driver.radioRelease();