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

Appearance settings

Commit ea2529b

Browse filesBrowse 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
Copy full SHA for ea2529b

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎common/src/serial.rs

Copy file name to clipboardExpand all lines: common/src/serial.rs
+6-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.