Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ea2529b

Browse files
authored
Merge pull request #474 from ChocolateLoverRaj/crlf-serial
Convert LF to CRLF when writing to serial port
2 parents af99f0f + 0688aee commit ea2529b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎common/src/serial.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ impl SerialPort {
1717

1818
impl fmt::Write for SerialPort {
1919
fn write_str(&mut self, s: &str) -> fmt::Result {
20-
self.port.write_str(s).unwrap();
20+
for char in s.bytes() {
21+
match char {
22+
b'\n' => self.port.write_str("\r\n").unwrap(),
23+
byte => self.port.send(byte),
24+
}
25+
}
2126
Ok(())
2227
}
2328
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /