Fix log messages not always showing up straight away

This commit is contained in:
Jomer.Dev 2024-01-08 00:21:22 +01:00
parent 6f505feeb1
commit f0c7504229

View file

@ -93,6 +93,9 @@ impl<const N: usize> UsbLogger<N> {
loop { loop {
let len = self.buffer.read(&mut rx[..]).await; let len = self.buffer.read(&mut rx[..]).await;
let _ = sender.write_packet(&rx[..len]).await; let _ = sender.write_packet(&rx[..len]).await;
if len as u8 == MAX_PACKET_SIZE {
let _ = sender.write_packet(&[]).await;
}
} }
}; };
let discard_fut = async { let discard_fut = async {
@ -121,6 +124,9 @@ impl<const N: usize> UsbLogger<N> {
loop { loop {
let len = self.buffer.read(&mut rx[..]).await; let len = self.buffer.read(&mut rx[..]).await;
let _ = sender.write_packet(&rx[..len]).await; let _ = sender.write_packet(&rx[..len]).await;
if len as u8 == MAX_PACKET_SIZE {
let _ = sender.write_packet(&[]).await;
}
} }
}; };
let discard_fut = async { let discard_fut = async {