From 434afa52f2ba103f33f901bc2e8c493ac7aaa98d Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Wed, 23 Oct 2024 19:04:29 +0300 Subject: [PATCH] [LR11X0] FSK preamble detector length configuration (#1286) * [LR11X0] pay more attention to selection of FSK preamble detector length --- src/modules/LR11x0/LR11x0.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/LR11x0/LR11x0.cpp b/src/modules/LR11x0/LR11x0.cpp index cfa96bb64..6bb4e2278 100644 --- a/src/modules/LR11x0/LR11x0.cpp +++ b/src/modules/LR11x0/LR11x0.cpp @@ -1117,7 +1117,11 @@ int16_t LR11x0::setPreambleLength(size_t preambleLength) { return(setPacketParamsLoRa(this->preambleLengthLoRa, this->headerType, this->implicitLen, this->crcTypeLoRa, (uint8_t)this->invertIQEnabled)); } else if(type == RADIOLIB_LR11X0_PACKET_TYPE_GFSK) { this->preambleLengthGFSK = preambleLength; - this->preambleDetLength = RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_16_BITS; + this->preambleDetLength = preambleLength >= 32 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_32_BITS : + preambleLength >= 24 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_24_BITS : + preambleLength >= 16 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_16_BITS : + preambleLength > 0 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_8_BITS : + RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_DISABLED; return(setPacketParamsGFSK(this->preambleLengthGFSK, this->preambleDetLength, this->syncWordLength, this->addrComp, this->packetType, RADIOLIB_LR11X0_MAX_PACKET_LENGTH, this->crcTypeGFSK, this->whitening)); }