From d272b2c3645f11885033708917f20d66650dd6d5 Mon Sep 17 00:00:00 2001 From: Andreas Neuhaus Date: Sat, 10 Aug 2024 16:59:02 +0200 Subject: [PATCH] Distinguish between Wifi initialization and runtime errors --- firmware/src/wifi.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/src/wifi.rs b/firmware/src/wifi.rs index 25a42b6..edd815a 100644 --- a/firmware/src/wifi.rs +++ b/firmware/src/wifi.rs @@ -6,8 +6,11 @@ use esp_wifi::wifi::{self, WifiController, WifiDevice, WifiStaDevice}; use esp_wifi::{EspWifiInitFor, EspWifiInitialization}; use log::{debug, info}; -/// Wifi error -pub use esp_wifi::wifi::WifiError as Error; +/// Wifi initialization error +pub use esp_wifi::InitializationError; + +// /// Wifi error +// pub use esp_wifi::wifi::WifiError as Error; /// Wifi interface pub struct Wifi<'d> { @@ -24,9 +27,8 @@ impl<'d> Wifi<'d> { radio_clocks: peripherals::RADIO_CLK, clocks: &Clocks<'d>, wifi: peripherals::WIFI, - ) -> Result { - let init = esp_wifi::initialize(EspWifiInitFor::Wifi, timer, rng, radio_clocks, clocks) - .map_err(|_| Error::NotInitialized)?; + ) -> Result { + let init = esp_wifi::initialize(EspWifiInitFor::Wifi, timer, rng, radio_clocks, clocks)?; let (device, mut controller) = wifi::new_with_mode(&init, wifi, WifiStaDevice)?; debug!("Static Wifi configuration: {:?}", esp_wifi::CONFIG);