From 172bdead1456d596f019bb5769a479884d272b92 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 20 Jun 2022 01:38:50 +0200 Subject: [PATCH] do a basic AT probe instead of waiting on startup --- src/modem.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modem.rs b/src/modem.rs index 87f908b..a8e82a8 100644 --- a/src/modem.rs +++ b/src/modem.rs @@ -102,8 +102,13 @@ impl Modem { pwrkey.set_low().map_err(|_| ModemError::SetupError("Error setting PWRKEY to low.".to_string()))?; thread::sleep(Duration::from_millis(1000)); pwrkey.set_high().map_err(|_| ModemError::SetupError("Error setting PWRKEY to high.".to_string()))?; - println!("Waiting 3s for sim module to come online ..."); - thread::sleep(Duration::from_millis(3000)); + println!("Waiting for sim module to come online ..."); + loop { + match self.send_command(Command::probe()) { + Ok(_) => break, + _ => continue, + } + } Ok(()) }