[LR11X0] FSK preamble detector length configuration (#1286)

* [LR11X0] pay more attention to selection of FSK preamble detector length
This commit is contained in:
Linar Yusupov 2024-10-23 19:04:29 +03:00 committed by GitHub
parent 8bc4b9a330
commit 434afa52f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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));
}