From 75f087b5c2f622d13f9c45fd4a5907f72cf09349 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 15 Dec 2024 15:53:13 +0100 Subject: [PATCH] [SX126x] Use length from startReceive in implicit header mode --- src/modules/SX126x/SX126x.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 7defbbcb..936756d7 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -641,7 +641,12 @@ int16_t SX126x::startReceive() { } int16_t SX126x::startReceive(uint32_t timeout, RadioLibIrqFlags_t irqFlags, RadioLibIrqFlags_t irqMask, size_t len) { - (void)len; + // in implicit header mode, use the provided length if it is nonzero + // otherwise we trust the user has previously set the payload length manually + if((this->headerType == RADIOLIB_SX126X_LORA_HEADER_IMPLICIT) && (len != 0)) { + this->implicitLen = len; + } + int16_t state = startReceiveCommon(timeout, irqFlags, irqMask); RADIOLIB_ASSERT(state);