From 45c5859338590b7eede23cb2f95284c3fb0cf08e Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 31 Mar 2023 22:02:58 +0200 Subject: [PATCH] [SX128x] Fixed packet length in implicit mode (#716) --- src/modules/SX128x/SX128x.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/SX128x/SX128x.cpp b/src/modules/SX128x/SX128x.cpp index 70ddf18e..3456e7c3 100644 --- a/src/modules/SX128x/SX128x.cpp +++ b/src/modules/SX128x/SX128x.cpp @@ -1182,6 +1182,12 @@ float SX128x::getFrequencyError() { size_t SX128x::getPacketLength(bool update) { (void)update; + + // in implicit mode, return the cached value + if((getPacketType() == RADIOLIB_SX128X_PACKET_TYPE_LORA) && (_headerType == RADIOLIB_SX128X_LORA_HEADER_IMPLICIT)) { + return(_payloadLen); + } + uint8_t rxBufStatus[2] = {0, 0}; _mod->SPIreadStream(RADIOLIB_SX128X_CMD_GET_RX_BUFFER_STATUS, rxBufStatus, 2); return((size_t)rxBufStatus[0]);