diff --git a/src/modem.rs b/src/modem.rs index 788bf39..6018de2 100644 --- a/src/modem.rs +++ b/src/modem.rs @@ -290,6 +290,8 @@ impl Modem { } 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 ...");