From 2829640e7cdb60e64d69d4eb55886777a9e38ab4 Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Wed, 29 Jan 2025 20:24:19 +0000 Subject: [PATCH] Use concurrent commissioning in the example so that it works with Alexa --- Cargo.toml | 2 -- examples/light.rs | 20 ++++++++++---------- examples/light_eth.rs | 1 + 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7e98636..bf69d4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,8 +25,6 @@ rust-version = "1.78" #rs-matter = { git = "https://github.com/project-chip/rs-matter" } rs-matter = { git = "https://github.com/ivmarkov/rs-matter", branch = "pase-breaks-provisioning" } #rs-matter = { path = "../rs-matter/rs-matter" } -#edge-nal = { path = "../edge-net/edge-nal" } -#edge-nal-std = { path = "../edge-net/edge-nal-std" } [profile.release] opt-level = "s" diff --git a/examples/light.rs b/examples/light.rs index 6b27aa8..f2014af 100644 --- a/examples/light.rs +++ b/examples/light.rs @@ -1,14 +1,14 @@ -//! An example utilizing the `EspWifiNCMatterStack` struct. +//! An example utilizing the `EspWifiMatterStack` struct. //! //! As the name suggests, this Matter stack assembly uses Wifi as the main transport, -//! (and thus BLE for commissioning), where `NC` stands for non-concurrent commisisoning -//! (i.e., the stack will not run the BLE and Wifi radio simultaneously, which saves memory). +//! and thus BLE for commissioning. //! //! If you want to use Ethernet, utilize `EspEthMatterStack` instead. -//! If you want to use concurrent commissioning, utilize `EspWifiMatterStack` instead -//! (Alexa does not work (yet) with non-concurrent commissioning). +//! If you want to use non-concurrent commissioning, utilize `EspWifiNCMatterStack` instead +//! (Note: Alexa does not work (yet) with non-concurrent commissioning.) //! //! The example implements a fictitious Light device (an On-Off Matter cluster). +#![allow(unexpected_cfgs)] use core::pin::pin; @@ -24,7 +24,7 @@ use esp_idf_matter::matter::utils::init::InitMaybeUninit; use esp_idf_matter::matter::utils::select::Coalesce; use esp_idf_matter::persist; use esp_idf_matter::stack::test_device::{TEST_BASIC_COMM_DATA, TEST_DEV_ATT, TEST_PID, TEST_VID}; -use esp_idf_matter::{init_async_io, EspMatterBle, EspMatterWifi, EspWifiNCMatterStack}; +use esp_idf_matter::{init_async_io, EspMatterBle, EspMatterWifi, EspWifiMatterStack}; use esp_idf_svc::eventloop::EspSystemEventLoop; use esp_idf_svc::hal::peripherals::Peripherals; @@ -46,7 +46,7 @@ fn main() -> Result<(), anyhow::Error> { // confused by the low priority of the ESP IDF main task // 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(75 * 1024) + .stack_size(85 * 1024) .spawn(|| { // Eagerly initialize `async-io` to minimize the risk of stack blowups later on init_async_io()?; @@ -78,7 +78,7 @@ async fn matter() -> Result<(), anyhow::Error> { // as we'll run it in this thread let stack = MATTER_STACK .uninit() - .init_with(EspWifiNCMatterStack::init_default( + .init_with(EspWifiMatterStack::init_default( &BasicInfoConfig { vid: TEST_VID, pid: TEST_PID, @@ -178,7 +178,7 @@ async fn matter() -> Result<(), anyhow::Error> { /// The Matter stack is allocated statically to avoid /// program stack blowups. /// It is also a mandatory requirement when the `WifiBle` stack variation is used. -static MATTER_STACK: StaticCell> = StaticCell::new(); +static MATTER_STACK: StaticCell> = StaticCell::new(); /// Endpoint 0 (the root endpoint) always runs /// the hidden Matter system clusters, so we pick ID=1 @@ -188,7 +188,7 @@ const LIGHT_ENDPOINT_ID: u16 = 1; const NODE: Node = Node { id: 0, endpoints: &[ - EspWifiNCMatterStack::<()>::root_metadata(), + EspWifiMatterStack::<()>::root_metadata(), Endpoint { id: LIGHT_ENDPOINT_ID, device_types: &[DEV_TYPE_ON_OFF_LIGHT], diff --git a/examples/light_eth.rs b/examples/light_eth.rs index f3032ea..07ceaf0 100644 --- a/examples/light_eth.rs +++ b/examples/light_eth.rs @@ -6,6 +6,7 @@ //! stack is not concerned with connecting to the Wifi network, managing its credentials etc. and can assume it "pre-exists". //! //! The example implements a fictitious Light device (an On-Off Matter cluster). +#![allow(unexpected_cfgs)] use core::pin::pin;