From c9e80434fe0528ef54676c8b6339e818470f53bf Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 20 Feb 2023 17:24:35 +0100 Subject: [PATCH] wait more between tcp connect reply reads --- src/modem.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modem.rs b/src/modem.rs index c040bf3..41d95ec 100644 --- a/src/modem.rs +++ b/src/modem.rs @@ -280,13 +280,15 @@ impl Modem Result<()> { let at_command = format!("AT+CIPSTART=\"TCP\",\"{}\",\"{}\"", addr, port); - let _ = self.send(&at_command, "CONNECT OK"); + let mut reply_result = self.send(&at_command, "CONNECT OK"); for _ in 0..3 { - if let Ok(reply) = self.command_read_response(Some("CONNECT OK".to_string())) { + if let Ok(reply) = reply_result { println!("TCP connect replied with {}", reply); break + } else { + reply_result = self.command_read_response(Some("CONNECT OK".to_string())); } - thread::sleep(Duration::from_millis(500)); + thread::sleep(Duration::from_millis(1000)); } Ok(()) }