From 2538af82a908fa144c33201ed954412e8dc28474 Mon Sep 17 00:00:00 2001 From: "Arthur B. Grossi" Date: Mon, 31 Jan 2022 18:10:41 -0300 Subject: [PATCH] [Si443x] Fixes getPacketLength Fixes getPacketLength function to read the correct register when on fixed packet length mode. --- src/modules/Si443x/Si443x.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/Si443x/Si443x.cpp b/src/modules/Si443x/Si443x.cpp index 90bba72e..f033d0ec 100644 --- a/src/modules/Si443x/Si443x.cpp +++ b/src/modules/Si443x/Si443x.cpp @@ -512,9 +512,12 @@ int16_t Si443x::setPreambleLength(uint8_t preambleLen) { } size_t Si443x::getPacketLength(bool update) { - /// \todo variable length mode if(!_packetLengthQueried && update) { - _packetLength = _mod->SPIreadRegister(RADIOLIB_SI443X_REG_RECEIVED_PACKET_LENGTH); + if (_packetLengthConfig == RADIOLIB_SI443X_FIXED_PACKET_LENGTH_ON) { + _packetLength = _mod->SPIreadRegister(RADIOLIB_SI443X_REG_TRANSMIT_PACKET_LENGTH); + } else { + _packetLength = _mod->SPIreadRegister(RADIOLIB_SI443X_REG_RECEIVED_PACKET_LENGTH); + } _packetLengthQueried = true; }