Skip to content

Commit 347b4c7

Browse files
committed
Fix available_buffer_size function
1 parent a7b7d64 commit 347b4c7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

firmware/defmt-rtt/src/channel.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ impl Channel {
111111
fn available_buffer_size(read_cursor: usize, write_cursor: usize) -> usize {
112112
if read_cursor > write_cursor {
113113
read_cursor - write_cursor - 1
114-
} else if read_cursor == 0 {
115-
BUF_SIZE - write_cursor - 1
116114
} else {
117-
BUF_SIZE - write_cursor
115+
BUF_SIZE - write_cursor - 1 + read_cursor
118116
}
119117
}

0 commit comments

Comments
 (0)