From c5563750a2407f181a6cc6177bca61ad59b2a95c Mon Sep 17 00:00:00 2001 From: John Millington Date: Tue, 9 Jun 2026 16:08:16 +1200 Subject: [PATCH] fix: disable LBT phase-2 optimisation for loramac-node sx127x backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The loramac-node sx127x backend holds a modem mutex for the full duration of async RX. lora_config() returns -EBUSY if called while that mutex is held, so the phase-2 path (skip hwCancelReceive, let send_async handle RX→TX transition) leaves the mutex permanently locked and silently drops all TX. Disable LBT for backends that set _loramac_node = true so RX is always cancelled before attempting to configure for TX. Co-Authored-By: Claude Sonnet 4.6 --- zephcore/adapters/radio/LoRaRadioBase.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zephcore/adapters/radio/LoRaRadioBase.cpp b/zephcore/adapters/radio/LoRaRadioBase.cpp index 4ff59b5..e2d0afb 100644 --- a/zephcore/adapters/radio/LoRaRadioBase.cpp +++ b/zephcore/adapters/radio/LoRaRadioBase.cpp @@ -511,10 +511,11 @@ bool LoRaRadioBase::startSendRaw(const uint8_t *bytes, int len) * isReceiving() returns false during the CAD window because _tx_active * is set above — no extra gating needed. * - * cad.mode = LBT is set unconditionally in buildModemConfig() today; - * the `lbt` flag is a placeholder for any future Kconfig that toggles - * the behaviour. */ - const bool lbt = true; + * The loramac-node sx127x backend uses a plain modem_acquire/release + * mutex — there is no phase-2 path. lora_config() returns -EBUSY if + * called while async RX holds the mutex, so we must always cancel RX + * first. Disable the LBT optimisation for that backend. */ + const bool lbt = !_loramac_node; if (!lbt) { atomic_set(&_in_recv_mode, 0);