byteBuff as intermediate buffer so we aren't writing straight to the buffer

Start to hopefully be able to access the buffer directly.
This commit is contained in:
Crsarmv7l 2024-04-29 18:02:38 -04:00 committed by GitHub
parent 841b283c0f
commit 9d0b24ae26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -420,22 +420,24 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) {
this->bufferWritePos = 0; this->bufferWritePos = 0;
this->bufferReadPos = 0; this->bufferReadPos = 0;
this->bufferBitPos = 0; this->bufferBitPos = 0;
this->byteBuff = 0;
} }
} else { } else {
// save the bit //read the bit
if(bit) { if(bit) {
this->buffer[this->bufferWritePos] |= 0x01 << this->bufferBitPos; byteBuff |= 0x01 << this->bufferBitPos;
} else { } else {
this->buffer[this->bufferWritePos] &= ~(0x01 << this->bufferBitPos); byteBuff &= ~(0x01 << this->bufferBitPos);
} }
this->bufferBitPos++; this->bufferBitPos++;
// check complete byte // check complete byte
if(this->bufferBitPos == 8) { if(this->bufferBitPos == 8) {
this->buffer[this->bufferWritePos] = Module::reflect(this->buffer[this->bufferWritePos], 8); this->buffer[this->bufferWritePos] = Module::reflect(byteBuff, 8);
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("R\t%X", this->buffer[this->bufferWritePos]); RADIOLIB_DEBUG_PROTOCOL_PRINTLN("R\t%X", byteBuff);
this->byteBuff = 0;
this->bufferWritePos++; this->bufferWritePos++;
this->bufferBitPos = 0; this->bufferBitPos = 0;
} }