rewrite wifi crate

This commit is contained in:
2026-09-02 20:11:40 +02:00
parent 0aa1370a2b
commit 240e2b081d
7 changed files with 110 additions and 150 deletions
+6 -3
View File
@@ -8,6 +8,7 @@
#![deny(clippy::large_stack_frames)]
use alloc::boxed::Box;
use alloc::sync::Arc;
use creaturedex::background_tasks;
use creaturedex::drivers::i2c_bus::I2cBusPinConfiguration;
use creaturedex::drivers::nfc_pn532::NfcPn532Driver;
@@ -22,6 +23,7 @@ use creaturedex::navigation::navigation::Mutex;
use creaturedex::navigation::navigation::{self};
use creaturedex::navigation::outputs::Outputs;
use creaturedex::navigation::state::NavigationState;
use creaturedex::network::wifi::setup_wifi;
use creaturedex::peripherals::Peripherals;
use creaturedex::peripherals::storage::cardstore::CardStore;
use creaturedex::peripherals::storage::store::Store;
@@ -126,10 +128,12 @@ async fn main(spawner: Spawner) {
let storage = esp_storage::FlashStorage::new(esp_peripherals.FLASH);
let nvs = Mutex::new(
let nvs = Arc::new(Mutex::new(
esp_nvs::Nvs::new(NVS_PARTITION_OFFSET, NVS_PARTITION_SIZE, storage)
.expect("failed to create nvs"),
);
));
setup_wifi(esp_peripherals.WIFI, Arc::clone(&nvs), &spawner).await;
let card_store = CardStore::new(nvs)
.await
@@ -137,7 +141,6 @@ async fn main(spawner: Spawner) {
let store = Store { card_store };
let rtc = Rtc::new(esp_peripherals.LPWR);
//setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await;
let peripherals = Box::leak(Box::new(Peripherals {
store: Mutex::new(store),