diff --git a/.github/configs/sdkconfig.defaults b/.github/configs/sdkconfig.defaults index c26e85a..d8992e1 100644 --- a/.github/configs/sdkconfig.defaults +++ b/.github/configs/sdkconfig.defaults @@ -1,7 +1,7 @@ # Increase a bit these stack sizes as they are too low by default CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=8192 -#CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=8192 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096 +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=8192 # For async-io # Go figure... CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096 @@ -17,4 +17,4 @@ CONFIG_BTDM_CTRL_MODE_BTDM=n CONFIG_BT_A2DP_ENABLE=n CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n -CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=n +CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y diff --git a/examples/light.rs b/examples/light.rs index f778389..f356ebf 100644 --- a/examples/light.rs +++ b/examples/light.rs @@ -44,9 +44,9 @@ fn main() -> Result<(), Error> { // Run in a higher-prio thread to avoid issues with `async-io` getting // confused by the low priority of the ESP IDF main task - // Also allocate a large stack as `rs-matter` futures do occupy quite some space + // Also allocate a very large stack (for now) as `rs-matter` futures do occupy quite some space let thread = std::thread::Builder::new() - .stack_size(60 * 1024) + .stack_size(80 * 1024) .spawn(run) .unwrap(); diff --git a/src/netif.rs b/src/netif.rs index b4b10be..7a2384f 100644 --- a/src/netif.rs +++ b/src/netif.rs @@ -76,7 +76,7 @@ where } } -pub fn get_ips(netif: &EspNetif) -> Result<(Ipv4Addr, Ipv6Addr), Error> { +pub fn get_ips(netif: &EspNetif) -> Result<(Ipv4Addr, Ipv6Addr, u32), Error> { let ip_info = netif.get_ip_info()?; let ipv4: Ipv4Addr = ip_info.ip.octets().into(); @@ -110,7 +110,9 @@ pub fn get_ips(netif: &EspNetif) -> Result<(Ipv4Addr, Ipv6Addr), Error> { ] .into(); - Ok((ipv4, ipv6)) + let interface = netif.get_index(); + + Ok((ipv4, ipv6, interface)) } #[cfg(esp_idf_comp_esp_eth_enabled)] diff --git a/src/stack.rs b/src/stack.rs index 9e58f2c..af22b16 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -116,19 +116,19 @@ where loop { info!("Waiting for the network to come up..."); - let (ipv4, ipv6) = netif + let (ipv4, ipv6, interface) = netif .wait(sysloop.clone(), |netif| Ok(get_ips(netif).ok())) .await?; - info!("Got network with IPs: IPv4={ipv4}, IPv6={ipv6}"); + info!("Got network with IPs: IPv4={ipv4}, IPv6={ipv6}, if={interface}"); let socket = async_io::Async::::bind(MATTER_SOCKET_BIND_ADDR)?; let mut main = pin!(self.run_once(&socket, &socket, nvs.clone(), dev_comm.clone(), &handler)); - let mut mdns = pin!(self.run_builtin_mdns(ipv4, ipv6)); + let mut mdns = pin!(self.run_builtin_mdns(ipv4, ipv6, interface)); let mut down = pin!(netif.wait(sysloop.clone(), |netif| { - let prev = Some((ipv4, ipv6)); + let prev = Some((ipv4, ipv6, interface)); let next = get_ips(netif).ok(); Ok((prev != next).then_some(())) @@ -212,7 +212,12 @@ where Ok(()) } - async fn run_builtin_mdns(&self, ipv4: Ipv4Addr, ipv6: Ipv6Addr) -> Result<(), Error> { + async fn run_builtin_mdns( + &self, + ipv4: Ipv4Addr, + ipv6: Ipv6Addr, + interface: u32, + ) -> Result<(), Error> { use rs_matter::mdns::{ Host, MDNS_IPV4_BROADCAST_ADDR, MDNS_IPV6_BROADCAST_ADDR, MDNS_SOCKET_BIND_ADDR, }; @@ -232,7 +237,7 @@ where ip: ipv4.octets(), ipv6: Some(ipv6.octets()), }, - Some(0), + Some(interface), ) .await?; diff --git a/src/wifi/mgmt.rs b/src/wifi/mgmt.rs index 97c03eb..05265e2 100644 --- a/src/wifi/mgmt.rs +++ b/src/wifi/mgmt.rs @@ -168,8 +168,8 @@ where &[AuthMethod::None] } else { &[ - AuthMethod::WPA2WPA3Personal, AuthMethod::WPAWPA2Personal, + AuthMethod::WPA2WPA3Personal, AuthMethod::WEP, ] };