bring selftest online, bring tz online, fix set_config/get_config race

This commit is contained in:
2025-09-24 22:29:58 +02:00
parent 5b009f50e5
commit e20b474dfd
13 changed files with 247 additions and 344 deletions

View File

@@ -6,10 +6,11 @@ use chrono::{DateTime, Utc};
use serde::Serialize;
use crate::hal::little_fs2storage_adapter::LittleFs2Filesystem;
use crate::FatError::{ContextExt, FatError, FatResult};
use crate::fat_error::{ContextExt, FatError, FatResult};
use alloc::string::ToString;
use alloc::sync::Arc;
use alloc::{format, string::String, vec::Vec};
use alloc::borrow::ToOwned;
use core::marker::PhantomData;
use core::net::{IpAddr, Ipv4Addr};
use core::str::FromStr;
@@ -317,7 +318,7 @@ impl Esp<'_> {
let stack = mk_static!(Stack, stack);
spawner
.spawn(connection(self.controller.clone(), ssid))
.spawn(connection(self.controller.clone(), ssid.to_owned()))
.ok();
spawner.spawn(net_task(runner)).ok();
spawner.spawn(run_dhcp(stack.clone(), gw_ip_addr_str)).ok();
@@ -328,13 +329,12 @@ impl Esp<'_> {
}
Timer::after(Duration::from_millis(500)).await;
}
println!(
"Connect to the AP `esp-wifi` and point your browser to http://{gw_ip_addr_str}:8080/"
);
println!("DHCP is enabled so there's no need to configure a static IP, just in case:");
while !stack.is_config_up() {
Timer::after(Duration::from_millis(100)).await
}
println!(
"Connect to the AP `${ssid}` and point your browser to http://{gw_ip_addr_str}/"
);
stack
.config_v4()
.inspect(|c| println!("ipv4 config: {c:?}"));
@@ -801,11 +801,6 @@ async fn connection(
controller: Arc<Mutex<CriticalSectionRawMutex, WifiController<'static>>>,
ssid: String,
) {
println!("start connection task");
println!(
"Device capabilities: {:?}",
controller.lock().await.capabilities()
);
let client_config = Configuration::AccessPoint(AccessPointConfiguration {
ssid: ssid.clone(),
..Default::default()
@@ -815,7 +810,6 @@ async fn connection(
.await
.set_configuration(&client_config)
.unwrap();
println!("Starting wifi");
controller.lock().await.start_async().await.unwrap();
println!("Wifi started!");
}