mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 04:40:52 +00:00
Allow set_power_saving
even for coex (#3081)
* Allow `set_power_saving` even for coex * CHANGELOG.md * Remove useless migration guide entry
This commit is contained in:
parent
4739a67ad7
commit
9a34d0e931
@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- `esp_wifi::init` now takes an `impl Peripheral` for RNG source (#2992)
|
||||
|
||||
- `set_power_saving` is now also available when the `coex` feature is activated (#3081)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a problem using BLE on ESP32-C6 when connected via Serial-JTAG (#2981)
|
||||
|
@ -26,4 +26,4 @@ As part of limiting public API changes due to config options, the `csi_enabled`
|
||||
# In `Cargo.toml`:
|
||||
-esp-wifi = { version = "0.12.0", features = ["wifi"] }
|
||||
+esp-wifi = { version = "0.12.0", features = ["wifi", "csi"] }
|
||||
```
|
||||
```
|
||||
|
@ -25,7 +25,6 @@ pub(crate) struct EspWifiConfig {
|
||||
pub(crate) scan_method: u32,
|
||||
}
|
||||
|
||||
#[cfg(not(coex))]
|
||||
#[non_exhaustive]
|
||||
#[derive(Default)]
|
||||
pub enum PowerSaveMode {
|
||||
@ -35,7 +34,6 @@ pub enum PowerSaveMode {
|
||||
Maximum,
|
||||
}
|
||||
|
||||
#[cfg(not(coex))]
|
||||
impl From<PowerSaveMode> for esp_wifi_sys::include::wifi_ps_type_t {
|
||||
fn from(s: PowerSaveMode) -> Self {
|
||||
match s {
|
||||
|
@ -16,12 +16,11 @@ use critical_section::Mutex;
|
||||
use enumset::EnumSet;
|
||||
use portable_atomic::{AtomicBool, AtomicU8, Ordering};
|
||||
|
||||
#[cfg(not(coex))]
|
||||
use crate::config::PowerSaveMode;
|
||||
#[cfg(feature = "csi")]
|
||||
use crate::wifi::CsiConfig;
|
||||
use crate::{
|
||||
binary::include::*,
|
||||
config::PowerSaveMode,
|
||||
hal::peripheral::{Peripheral, PeripheralRef},
|
||||
wifi::{Protocol, RxControlInfo, WifiError},
|
||||
EspWifiController,
|
||||
@ -340,7 +339,6 @@ impl EspNowManager<'_> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(coex))]
|
||||
/// Configures modem power saving
|
||||
pub fn set_power_saving(&self, ps: PowerSaveMode) -> Result<(), WifiError> {
|
||||
crate::wifi::apply_power_saving(ps)
|
||||
|
@ -61,10 +61,9 @@ use serde::{Deserialize, Serialize};
|
||||
use smoltcp::phy::{Device, DeviceCapabilities, RxToken, TxToken};
|
||||
pub use state::*;
|
||||
|
||||
#[cfg(not(coex))]
|
||||
use crate::config::PowerSaveMode;
|
||||
use crate::{
|
||||
common_adapter::*,
|
||||
config::PowerSaveMode,
|
||||
esp_wifi_result,
|
||||
hal::{
|
||||
peripheral::{Peripheral, PeripheralRef},
|
||||
@ -2516,7 +2515,6 @@ impl<'d> WifiController<'d> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(coex))]
|
||||
/// Configures modem power saving
|
||||
pub fn set_power_saving(&mut self, ps: PowerSaveMode) -> Result<(), WifiError> {
|
||||
apply_power_saving(ps)
|
||||
@ -3190,7 +3188,6 @@ pub(crate) mod embassy {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(coex))]
|
||||
pub(crate) fn apply_power_saving(ps: PowerSaveMode) -> Result<(), WifiError> {
|
||||
esp_wifi_result!(unsafe { esp_wifi_sys::include::esp_wifi_set_ps(ps.into()) })?;
|
||||
Ok(())
|
||||
|
@ -90,6 +90,9 @@ fn main() -> ! {
|
||||
|
||||
let (iface, device, mut controller) =
|
||||
create_network_interface(&init, &mut wifi, WifiStaDevice).unwrap();
|
||||
controller
|
||||
.set_power_saving(esp_wifi::config::PowerSaveMode::None)
|
||||
.unwrap();
|
||||
|
||||
let mut socket_set_entries: [SocketStorage; 3] = Default::default();
|
||||
let mut socket_set = SocketSet::new(&mut socket_set_entries[..]);
|
||||
|
@ -63,6 +63,9 @@ fn main() -> ! {
|
||||
let mut wifi = peripherals.WIFI;
|
||||
let (iface, device, mut controller) =
|
||||
create_network_interface(&init, &mut wifi, WifiStaDevice).unwrap();
|
||||
controller
|
||||
.set_power_saving(esp_wifi::config::PowerSaveMode::None)
|
||||
.unwrap();
|
||||
|
||||
let mut socket_set_entries: [SocketStorage; 3] = Default::default();
|
||||
let mut socket_set = SocketSet::new(&mut socket_set_entries[..]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user