Draft
Conversation
fd5e77d to
4cb10d9
Compare
rslawson
requested changes
Jan 26, 2026
Collaborator
rslawson
left a comment
There was a problem hiding this comment.
Mostly just did a linting pass since this is a draft PR. I'll have a proper look at this when it's moved out of draft (:
Comment on lines
+294
to
+296
| loop { | ||
| continue; | ||
| } |
Collaborator
There was a problem hiding this comment.
Personally I prefer just a loop {} and putting #[allow(clippy::empty_loop)] on the item it's in, but this works just as well.
| let hal_rx_temp = ReceiveRingbuffer::new(scatter, 0); | ||
| find_alignment_offset(&hal_tx_temp, &hal_rx_temp) | ||
| }; | ||
| writeln!(uart, " Alignment offset: {}", rx_offset).ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!(uart, " Alignment offset: {}", rx_offset).ok(); | |
| writeln!(uart, " Alignment offset: {rx_offset}").ok(); |
| let tx_buffer = TransmitRingbuffer::new(gather); | ||
| let mut device = RingbufferDevice::new(rx_buffer, tx_buffer); | ||
| let mtu = device.mtu(); | ||
| writeln!(uart, " MTU: {} bytes", mtu).ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!(uart, " MTU: {} bytes", mtu).ok(); | |
| writeln!(uart, " MTU: {mtu} bytes").ok(); |
| iface.update_ip_addrs(|addrs| { | ||
| addrs.push(ip_addr).unwrap(); | ||
| }); | ||
| writeln!(uart, " IP: {}", ip_addr).ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!(uart, " IP: {}", ip_addr).ok(); | |
| writeln!(uart, " IP: {ip_addr}").ok(); |
| let client = sockets.get_mut::<tcp::Socket>(client_handle); | ||
| if client.can_send() { | ||
| if let Ok(sent) = client.send_slice(test_data) { | ||
| writeln!(uart, " Sent {} bytes", sent).ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!(uart, " Sent {} bytes", sent).ok(); | |
| writeln!(uart, " Sent {sent} bytes").ok(); |
| if server.can_recv() { | ||
| if let Ok(len) = server.recv_slice(&mut received_data) { | ||
| received_len = len; | ||
| writeln!(uart, " Received {} bytes", len).ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!(uart, " Received {} bytes", len).ok(); | |
| writeln!(uart, " Received {len} bytes").ok(); |
Comment on lines
+195
to
+200
| writeln!( | ||
| uart, | ||
| " Expected {} bytes: {:?}", | ||
| test_data.len(), | ||
| test_data | ||
| ) |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!( | |
| uart, | |
| " Expected {} bytes: {:?}", | |
| test_data.len(), | |
| test_data | |
| ) | |
| writeln!( | |
| uart, | |
| " Expected {} bytes: {test_data:?}", | |
| test_data.len(), | |
| ) |
| test_data | ||
| ) | ||
| .ok(); | ||
| writeln!(uart, " Got {} bytes: {:?}", received_len, received_slice).ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!(uart, " Got {} bytes: {:?}", received_len, received_slice).ok(); | |
| writeln!(uart, " Got {received_len} bytes: {received_slice:?}").ok(); |
Comment on lines
+106
to
+111
| writeln!( | ||
| uart, | ||
| "Step 5: Starting TCP server on port {}...", | ||
| SERVER_PORT | ||
| ) | ||
| .ok(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| writeln!( | |
| uart, | |
| "Step 5: Starting TCP server on port {}...", | |
| SERVER_PORT | |
| ) | |
| .ok(); | |
| writeln!( | |
| uart, | |
| "Step 5: Starting TCP server on port {SERVER_PORT}...", | |
| ) | |
| .ok(); |
Comment on lines
+270
to
+275
| trace!( | ||
| "Transmitted packet: checksum {}, seq {}, total length {}", | ||
| crc, | ||
| self.seq_num, | ||
| total_len, | ||
| ); |
Collaborator
There was a problem hiding this comment.
Suggested change
| trace!( | |
| "Transmitted packet: checksum {}, seq {}, total length {}", | |
| crc, | |
| self.seq_num, | |
| total_len, | |
| ); | |
| trace!( | |
| "Transmitted packet: checksum {crc}, seq {}, total length {total_len}", | |
| self.seq_num, | |
| ); |
54c66c4 to
84a2cc6
Compare
fdb988d to
33ba9af
Compare
339d8e6 to
a912dd6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds the implementation of
smoltcp'sDevicetrait for a pair ofTransmitRingbufferandReceiveRingbufferalongside with a unit test that verifies whether we can connect, send and receive data.I have to further sanity check if the current implementation for consuming the
RxTokenandTxTokenis alright for now or if we can do better (thanks Claude), but at least we have a unit test that shows that the concept works.The current device implementation uses the first 32 bits of the packet as identifier to differentiate between new and old packets. Incoming packets can be malformed on a physical level, so the implementation processes each packet twice.
TODOs:
RxToken'sTxToken's[[u8; 8]; SIZE]