Skip to content

Commit b11eb25

Browse files
authored
Merge pull request ExpressLRS#3473 from pkendall64/fix-gemini-K-modes
Clear the FEC encode buffer before use
2 parents 9bb96f6 + 14c8c6d commit b11eb25

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/LR1121Driver/LR1121.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class CopyCodec final : public BufferCodec
3434

3535
void ICACHE_RAM_ATTR FECCodec::encode(uint8_t *out, uint8_t *in, uint32_t len)
3636
{
37+
memset(out, 0, len); // ensure that the buffer is zeroed to start
3738
FECEncode(in, out);
3839
}
3940

@@ -643,7 +644,7 @@ void ICACHE_RAM_ATTR LR1121Driver::TXnb(uint8_t *data, const bool sendGeminiBuff
643644
}
644645

645646
WORD_ALIGNED_ATTR uint8_t outBuffer[32] = {0};
646-
const uint8_t length = PayloadLength+3;
647+
const uint8_t length = PayloadLength + 3; // 3 extra zero bytes for the 24-bit timeout
647648
codec->encode(outBuffer, data, PayloadLength);
648649
if (sendGeminiBuffer)
649650
{

0 commit comments

Comments
 (0)