rewrite wifi crate
This commit is contained in:
+7
-3
@@ -1,12 +1,15 @@
|
||||
use crate::navigation::navigation::Mutex;
|
||||
use crate::peripherals::storage::Nvs;
|
||||
use alloc::sync::Arc;
|
||||
use embassy_executor::Spawner;
|
||||
|
||||
#[cfg(not(feature = "wokwi"))]
|
||||
pub async fn setup_wifi(
|
||||
wifi: esp_hal::peripherals::WIFI<'static>,
|
||||
flash: esp_hal::peripherals::FLASH<'static>,
|
||||
nvs: Arc<Mutex<Nvs>>,
|
||||
spawner: &Spawner,
|
||||
) {
|
||||
let nvs = esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash).unwrap();
|
||||
let espnvs = esp_hal_wifimanager::Nvs::new_from_nvs(nvs, 0, 0);
|
||||
|
||||
let mut wm_settings = esp_hal_wifimanager::WmSettings::default();
|
||||
|
||||
@@ -19,7 +22,8 @@ pub async fn setup_wifi(
|
||||
wm_settings.wifi_conn_timeout = 30000;
|
||||
wm_settings.esp_reset_timeout = Some(300000); // 5min
|
||||
|
||||
let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await;
|
||||
let wifi_res =
|
||||
esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&espnvs), wifi, None).await;
|
||||
|
||||
log::info!("wifi_res: {wifi_res:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user