diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 70464ba7..7d35056f 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -435,6 +435,9 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) { // check complete byte if(this->bufferBitPos == 8) { + if(this->bufferWritePos >= RADIOLIB_STATIC_ARRAY_SIZE) { + this->bufferWritePos = 0; + } this->buffer[this->bufferWritePos] = Module::reflect(this->byteBuff, 8); RADIOLIB_DEBUG_PROTOCOL_PRINTLN("R\t%X", this->byteBuff);