TODO: handle reading lines in a bettwr way

This commit is contained in:
Vladan Popovic 2022-07-20 12:27:42 +02:00
parent db3cd1548e
commit 63359cc4c0
1 changed files with 2 additions and 0 deletions

View File

@ -101,6 +101,8 @@ impl<UART: serial::Uart> SerialIO<UART> {
.take_while(|c| *c != '\n') .take_while(|c| *c != '\n')
.collect(); .collect();
// TODO: \r\n is true for sim800l, but might not be valud for other devices. Re-implement
// this function so that it can be used on all devices.
// \r must come right before \n on read; take_while excludes the matched element. // \r must come right before \n on read; take_while excludes the matched element.
if line.ends_with('\r') { if line.ends_with('\r') {
line.push('\n'); line.push('\n');