From c88cf551cc2a3c9d2bb918f14a1359c9d2d58dc8 Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Thu, 6 Mar 2025 19:47:59 +0300 Subject: [PATCH] [SX128x] fix for improper GFSK syncword setting with length other than 5 bytes (#1446) * [SX128x] fix for improper GFSK syncword setting with length other than 5 bytes * [SX128x] misc. rework --- src/modules/SX128x/SX128x.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SX128x/SX128x.cpp b/src/modules/SX128x/SX128x.cpp index 7a719ab4..e0ddb6a3 100644 --- a/src/modules/SX128x/SX128x.cpp +++ b/src/modules/SX128x/SX128x.cpp @@ -997,7 +997,7 @@ int16_t SX128x::setSyncWord(const uint8_t* syncWord, uint8_t len) { } // update sync word - int16_t state = SX128x::writeRegister(RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_4, const_cast(syncWord), len); + int16_t state = SX128x::writeRegister(RADIOLIB_SX128X_REG_SYNC_WORD_1_BYTE_4 + (5 - len), const_cast(syncWord), len); RADIOLIB_ASSERT(state); // update packet parameters