From c9fd5f7d3bc269c13167afaf9caedb3e273c54e9 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Thu, 5 Sep 2024 13:10:11 +0100 Subject: [PATCH] Add support for retrieving packet length on implicit header --- Radio.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Radio.cpp b/Radio.cpp index 6b2557f..b252cbe 100644 --- a/Radio.cpp +++ b/Radio.cpp @@ -2576,8 +2576,17 @@ void sx128x::handleDio0Rise() uint8_t rxbuf[2] = {0}; executeOpcodeRead(OP_RX_BUFFER_STATUS_8X, rxbuf, 2); - _rxPacketLength = rxbuf[0]; + + // If implicit header mode is enabled, read packet length as payload length instead. + // See SX1280 datasheet v3.2, page 92 + if (_implicitHeaderMode == 0x80) { + _rxPacketLength = _payloadLength; + } else { + _rxPacketLength = rxbuf[0]; + } + _fifo_rx_addr_ptr = rxbuf[1]; + readBuffer(_packet, _rxPacketLength); if (_onReceive) {