From e915deb1d584aa8100aa9db1ba4ee123c35e80b1 Mon Sep 17 00:00:00 2001 From: doryan Date: Tue, 27 May 2025 21:27:11 +0400 Subject: [PATCH] fix: send only bytes written to the buffer instead of the entire buffer --- src/structures/ring_buffer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/structures/ring_buffer.rs b/src/structures/ring_buffer.rs index f5681f6..4483fe8 100644 --- a/src/structures/ring_buffer.rs +++ b/src/structures/ring_buffer.rs @@ -109,14 +109,14 @@ where crate::_priv_write_bytes::

(data); } + #[inline(never)] fn write_bytes(&self, transmit_data: &mut RingBuffer) { >>::write_byte( self, transmit_data.len() as u8, ); - for _ in 0..N { - let byte = transmit_data.pop().unwrap_or(0); + for byte in transmit_data { self.sync_transmitter(); >>::write_byte(self, byte); } @@ -132,6 +132,7 @@ where crate::_priv_read_byte::

() } + #[inline(never)] fn read_bytes(&self, recieve_data: &mut RingBuffer) { let byte = >>::read_byte(self);