From 9d0b24ae26998783197ac1257ec33be48f59b37c Mon Sep 17 00:00:00 2001 From: Crsarmv7l <85343771+Crsarmv7l@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:02:38 -0400 Subject: [PATCH] byteBuff as intermediate buffer so we aren't writing straight to the buffer Start to hopefully be able to access the buffer directly. --- src/protocols/PhysicalLayer/PhysicalLayer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 822cc18a..6ce514d5 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -420,22 +420,24 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) { this->bufferWritePos = 0; this->bufferReadPos = 0; this->bufferBitPos = 0; + this->byteBuff = 0; } } else { - // save the bit + //read the bit if(bit) { - this->buffer[this->bufferWritePos] |= 0x01 << this->bufferBitPos; + byteBuff |= 0x01 << this->bufferBitPos; } else { - this->buffer[this->bufferWritePos] &= ~(0x01 << this->bufferBitPos); + byteBuff &= ~(0x01 << this->bufferBitPos); } this->bufferBitPos++; // check complete byte if(this->bufferBitPos == 8) { - this->buffer[this->bufferWritePos] = Module::reflect(this->buffer[this->bufferWritePos], 8); - RADIOLIB_DEBUG_PROTOCOL_PRINTLN("R\t%X", this->buffer[this->bufferWritePos]); + this->buffer[this->bufferWritePos] = Module::reflect(byteBuff, 8); + RADIOLIB_DEBUG_PROTOCOL_PRINTLN("R\t%X", byteBuff); + this->byteBuff = 0; this->bufferWritePos++; this->bufferBitPos = 0; }