From 3676c8224bee2a70962863bcb0dd129a013ffa9c Mon Sep 17 00:00:00 2001 From: Tao Tien <29749622+taotien@users.noreply.github.com> Date: Mon, 12 Jun 2023 20:02:11 -0700 Subject: [PATCH] change to be consistent with set_lora_modem() doc --- src/lib.rs | 4 ++-- src/sx1276_7_8_9/mod.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 539c395..a058e4c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -149,8 +149,8 @@ where self.radio_kind.reset(delay).await?; self.radio_kind.ensure_ready(self.radio_mode).await?; self.radio_kind.init_rf_switch().await?; - self.radio_kind.set_standby().await?; - self.radio_mode = RadioMode::Standby; + self.radio_kind.set_sleep(delay).await?; + self.radio_mode = RadioMode::Sleep; self.rx_continuous = false; self.radio_kind.set_lora_modem(enable_public_network).await?; self.radio_kind.set_oscillator().await?; diff --git a/src/sx1276_7_8_9/mod.rs b/src/sx1276_7_8_9/mod.rs index 8ab5416..200e369 100644 --- a/src/sx1276_7_8_9/mod.rs +++ b/src/sx1276_7_8_9/mod.rs @@ -164,6 +164,7 @@ where /// The sx127x LoRa mode is set when setting a mode while in sleep mode. async fn set_lora_modem(&mut self, enable_public_network: bool) -> Result<(), RadioError> { + self.ensure_ready(RadioMode::Sleep).await?; if enable_public_network { self.write_register(Register::RegSyncWord, LORA_MAC_PUBLIC_SYNCWORD, false) .await