Skip to content

Commit

Permalink
Distinguish between Wifi initialization and runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Aug 10, 2024
1 parent d7b9165 commit d272b2c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions firmware/src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand All @@ -24,9 +27,8 @@ impl<'d> Wifi<'d> {
radio_clocks: peripherals::RADIO_CLK,
clocks: &Clocks<'d>,
wifi: peripherals::WIFI,
) -> Result<Self, Error> {
let init = esp_wifi::initialize(EspWifiInitFor::Wifi, timer, rng, radio_clocks, clocks)
.map_err(|_| Error::NotInitialized)?;
) -> Result<Self, InitializationError> {
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);
Expand Down

0 comments on commit d272b2c

Please sign in to comment.