Skip to content

Commit d856909

Browse files
committed
example: clear BT RX buffer after processing
the way the buffer is used in the DMA operation means that it's never cleared out. as long as the new messages are the same length (or longer) than the previous ones means that they just overwrite each other and everything is fine. but if the previous message was longer (which can happen if multiple button presses happen fast enough one after the other, thus leading to no line idle interrupt in-between) the next message will only overwrite the first command(s) and the other old commands will stay in there and be processed again.
1 parent 55f2449 commit d856909

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

examples/stm32f4-event-printer/src/adafruit_bluefruit_le_uart_friend.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ impl BluefruitLEUARTFriend {
8484
defmt::info!("received event(s) over bluetooth: {}", &event);
8585

8686
// switch out the buffers
87+
filled_buffer.fill(0);
8788
self.rx_buffer = Some(filled_buffer);
8889

8990
self.rx_transfer.clear_idle_interrupt();

0 commit comments

Comments
 (0)