fix bug in timeout handling
use timeout.saturating_sub instead of plain '-'
This commit is contained in:
parent
f0d474d062
commit
327c86a504
1 changed files with 1 additions and 1 deletions
|
@ -150,7 +150,7 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
let match_text: String = contains.unwrap_or("\n".to_string());
|
let match_text: String = contains.unwrap_or("\n".to_string());
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let timeout = timeout - start.elapsed();
|
let timeout = timeout.saturating_sub(start.elapsed());
|
||||||
let line = self.rx.read_line(timeout)?;
|
let line = self.rx.read_line(timeout)?;
|
||||||
print!("Read {} bytes from serial: {}", line.len(), line);
|
print!("Read {} bytes from serial: {}", line.len(), line);
|
||||||
response.push_str(&line);
|
response.push_str(&line);
|
||||||
|
|
Loading…
Reference in a new issue