Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build]
target = "riscv32imc-esp-espidf"
# target = "xtensa-esp32-espidf"
#target = "riscv32imac-esp-espidf"
#target = "xtensa-esp32-espidf"

[target.xtensa-esp32-espidf]
linker = "ldproxy"
Expand All @@ -25,6 +26,7 @@ rustflags = ["--cfg", "espidf_time64"]
[env]
ESP_IDF_SDKCONFIG_DEFAULTS = ".github/configs/sdkconfig.defaults"
ESP_IDF_VERSION = "v5.3.2"
#ESP_IDF_VERSION = "release/v5.3" Necessary for `Thread::stop`

[unstable]
build-std = ["std", "panic_abort"]
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Breaking
- Implement MQTT outbox limit and get_outbox_size()
- Added argument `subprotocol_list` to `ws_handler` to allow subprotocols to be supported by WebSockets
- Thread enhancements (#592). Specifically:
- Thread SRP (Thread-specific mDNS) is now supported and has a new API so that the user can register/unregister SRP services
- Option to start/stop the Thread stack (methods `Thread::start` / `Thread::stop` in place of the previous `Thread::run`)
- Several callbacks where actually unsound, as they were not `Send + 'static`. Now fixed
- Simplifications:
- `Thread::init` and `Thread::deinit` are now gone
- No option to swap the Thread Netif with a custom one, as it complicates the implementation, and I don't see the use-case (unlike with Wifi)

### Fixed
- Fix wrong conversion from `ScanType` to `u32` in Wi-Fi configuration
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readme = "README.md"
links = "esp_idf_svc"
build = "build.rs"
documentation = "https://docs.esp-rs.org/esp-idf-svc/"
rust-version = "1.77"
rust-version = "1.82"

[patch.crates-io]
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }
Expand Down
9 changes: 5 additions & 4 deletions examples/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ mod example {
let mut thread =
EspThread::new(peripherals.modem, sys_loop.clone(), nvs, mounted_event_fs)?;

thread.init()?;

info!("Thread initialized, now running...");

thread.run()?;
thread.start()?;

Ok(())
loop {
// Keep the main thread alive to allow the Thread Border Router to run
std::thread::sleep(std::time::Duration::from_secs(2));
}
}

fn log_thread_sysloop(
Expand Down
9 changes: 5 additions & 4 deletions examples/thread_br.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,19 @@ mod example {
wifi.wifi().sta_netif(),
)?;

thread.init()?;

#[cfg(esp32c6)]
thread.init_coex()?;

thread.set_tod_from_cfg()?;

info!("Thread Border Router initialized, now running...");

thread.run()?;
thread.start()?;

Ok(())
loop {
// Keep the main thread alive to allow the Thread Border Router to run
std::thread::sleep(std::time::Duration::from_secs(2));
}
}

fn connect_wifi(wifi: &mut BlockingWifi<EspWifi<'static>>) -> anyhow::Result<()> {
Expand Down
9 changes: 5 additions & 4 deletions examples/thread_rcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ mod example {
mounted_event_fs,
)?;

thread.init()?;

info!("Thread RCP initialized, now running...");

thread.run()?;
thread.start()?;

Ok(())
loop {
// Keep the main thread alive to allow the Thread Border Router to run
std::thread::sleep(std::time::Duration::from_secs(2));
}
}

fn log_thread_sysloop(
Expand Down
2 changes: 1 addition & 1 deletion src/bt/ble/gatt/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl<'a> From<(esp_gatts_cb_event_t, &'a esp_ble_gatts_cb_param_t)> for GattsEve
conn_id: param.exec_write.conn_id,
addr: param.exec_write.bda.into(),
trans_id: param.exec_write.trans_id,
canceled: param.exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_CANCEL as _,
canceled: param.exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_CANCEL as u8,
}
},
esp_gatts_cb_event_t_ESP_GATTS_MTU_EVT => unsafe {
Expand Down
7 changes: 6 additions & 1 deletion src/netif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,13 @@ impl EspNetif {
Ok(netif)
}

pub fn is_netif_up(&self) -> Result<bool, EspError> {
Ok(unsafe { esp_netif_is_netif_up(self.handle) })
}

// TODO: Copy and rename to `is_up_ipv4` and deprecate the `is_up` variant in future
pub fn is_up(&self) -> Result<bool, EspError> {
if !unsafe { esp_netif_is_netif_up(self.handle) } {
if !self.is_netif_up()? {
Ok(false)
} else {
let mut ip_info = Default::default();
Expand Down
Loading