Skip to content

Commit 0688aee

Browse files
Convert LF to CRLF when writing to serial port
1 parent af99f0f commit 0688aee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/src/serial.rs

+6-1
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)