Skip to content

Commit

Permalink
Create IPv6 address
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Jun 1, 2024
1 parent ba4805e commit d08fe8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,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(65 * 1024)
.stack_size(70 * 1024)
.spawn(|| {
// Eagerly initialize `async-io` to minimize the risk of stack blowups later on
init_async_io()?;
Expand Down
11 changes: 9 additions & 2 deletions src/stack/wifible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ use esp_idf_svc::eventloop::EspSystemEventLoop;
use esp_idf_svc::hal::peripheral::{Peripheral, PeripheralRef};
use esp_idf_svc::hal::task::embassy_sync::EspRawMutex;
use esp_idf_svc::hal::{into_ref, modem};
use esp_idf_svc::handle::RawHandle;
use esp_idf_svc::nvs::EspDefaultNvsPartition;
use esp_idf_svc::sys::EspError;
use esp_idf_svc::sys::{esp, esp_netif_create_ip6_linklocal, EspError};
use esp_idf_svc::timer::EspTaskTimerService;
use esp_idf_svc::wifi::{AccessPointInfo, AsyncWifi, Capability, Configuration, EspWifi};

Expand Down Expand Up @@ -211,7 +212,13 @@ impl<'a, 'd> Wifi for EspL2<'a, 'd> {
}

async fn connect(&mut self) -> Result<(), Self::Error> {
self.0.wifi.lock().await.connect().await
let mut wifi = self.0.wifi.lock().await;

wifi.connect().await?;

esp!(unsafe { esp_netif_create_ip6_linklocal(wifi.wifi().sta_netif().handle() as _) })?;

Ok(())
}

async fn disconnect(&mut self) -> Result<(), Self::Error> {
Expand Down

0 comments on commit d08fe8f

Please sign in to comment.