Skip to content

Commit

Permalink
Use concurrent commissioning in the example so that it works with Alexa
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Jan 29, 2025
1 parent cca4160 commit 2829640
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 10 additions & 10 deletions examples/light.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
Expand All @@ -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()?;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<EspWifiNCMatterStack<()>> = StaticCell::new();
static MATTER_STACK: StaticCell<EspWifiMatterStack<()>> = StaticCell::new();

/// Endpoint 0 (the root endpoint) always runs
/// the hidden Matter system clusters, so we pick ID=1
Expand All @@ -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],
Expand Down
1 change: 1 addition & 0 deletions examples/light_eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2829640

Please sign in to comment.