clear RX before sending AT commands

This commit is contained in:
Vladan Popovic 2023-02-12 11:59:33 +01:00
parent 576bcfc590
commit ff779d0dc3

View file

@ -290,6 +290,8 @@ impl<UART: serial::Uart> Modem<UART> {
}
pub fn tcp_manual_send(&mut self, buf: &[u8]) -> Result<()> {
thread::sleep(Duration::from_millis(200));
self.serial.clear();
self.tcp_manual_send_data(buf)
.map(|_| ())
}
@ -556,8 +558,6 @@ where
)?;
}
if let Ok(()) = mdm.try_connect_gprs() {
let device_id = "c36a72df-5bd6-4f9b-995d-059433bc3267";
// When command AT+CIPQSEND=0, it is in normal sending mode. In this mode, after user
// sends data by AT+CIPSEND, if the server receives TCP data, it will give ACK message
// to module, and the module will respond SEND OK.
@ -571,9 +571,8 @@ where
continue;
}
}
thread::sleep(Duration::from_millis(500));
mdm.serial.clear();
let device_id = "c36a72df-5bd6-4f9b-995d-059433bc3267";
let _ = mdm.mqtt_connect(device_id)?;
println!("entering queue receive loop ...");