Convert LF to CRLF when writing to serial port#474
Merged
Freax13 merged 1 commit intorust-osdev:mainfrom Nov 22, 2024
Merged
Conversation
Freax13
approved these changes
Nov 22, 2024
Member
Freax13
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
This looks good to me! ![]()
Comment on lines
+20
to
+25
| for char in s.bytes() { | ||
| match char { | ||
| b'\n' => self.port.write_str("\r\n").unwrap(), | ||
| byte => self.port.send(byte), | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Another fix for #473 might be to change the writeln! call to a write("...\r\n") call, this wouldn't work if the log message contains multi-line strings, so I think this solution is preferable.
Performance could certainly be improved a bit, but this code is not at all performance-critical, so let's keep things simple.
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.
Fixes #473
I'm not sure if this is the best way to implement this in terms of performance.
This fixes the issue withUPDATE: I forgot to change theLockedLogger, but the logging that gets done before that still doesn't use CRLF, which is why I marked this as a draft PR.bootloaderdependency in Cargo.toml, after changing it all logging was as expected.Without this change

With this change:
