clear RX before sending AT commands
This commit is contained in:
parent
576bcfc590
commit
ff779d0dc3
1 changed files with 3 additions and 4 deletions
|
@ -290,6 +290,8 @@ impl<UART: serial::Uart> Modem<UART> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tcp_manual_send(&mut self, buf: &[u8]) -> Result<()> {
|
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)
|
self.tcp_manual_send_data(buf)
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
@ -556,8 +558,6 @@ where
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
if let Ok(()) = mdm.try_connect_gprs() {
|
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
|
// 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
|
// 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.
|
// to module, and the module will respond SEND OK.
|
||||||
|
@ -571,9 +571,8 @@ where
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thread::sleep(Duration::from_millis(500));
|
|
||||||
mdm.serial.clear();
|
|
||||||
|
|
||||||
|
let device_id = "c36a72df-5bd6-4f9b-995d-059433bc3267";
|
||||||
let _ = mdm.mqtt_connect(device_id)?;
|
let _ = mdm.mqtt_connect(device_id)?;
|
||||||
|
|
||||||
println!("entering queue receive loop ...");
|
println!("entering queue receive loop ...");
|
||||||
|
|
Loading…
Reference in a new issue