Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: esp-rs/esp-hal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1338c31510938a8e6fcbd0465dcb9a18a72e2c63
Choose a base ref
..
head repository: esp-rs/esp-hal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9a3811e6e72c200617699e60a06d1607e50e65e4
Choose a head ref
Showing with 10 additions and 5 deletions.
  1. +2 −0 esp-wifi/src/config.rs
  2. +3 −2 esp-wifi/src/esp_now/mod.rs
  3. +5 −3 esp-wifi/src/wifi/mod.rs
2 changes: 2 additions & 0 deletions esp-wifi/src/config.rs
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ pub(crate) struct EspWifiConfig {
pub(crate) scan_method: u32,
}

#[cfg(not(coex))]
#[non_exhaustive]
#[derive(Default)]
pub enum PowerSaveMode {
@@ -36,6 +37,7 @@ pub enum PowerSaveMode {
Maximum,
}

#[cfg(not(coex))]
impl From<PowerSaveMode> for include::wifi_ps_type_t {
fn from(s: PowerSaveMode) -> Self {
match s {
5 changes: 3 additions & 2 deletions esp-wifi/src/esp_now/mod.rs
Original file line number Diff line number Diff line change
@@ -16,9 +16,10 @@ use critical_section::Mutex;
use enumset::EnumSet;
use portable_atomic::{AtomicBool, AtomicU8, Ordering};

#[cfg(coex)]
use crate::config::PowerSaveMode;
use crate::{
binary::include::*,
config::PowerSaveMode,
hal::peripheral::{Peripheral, PeripheralRef},
wifi::{Protocol, RxControlInfo, WifiError},
EspWifiController,
@@ -336,7 +337,7 @@ impl EspNowManager<'_> {
Ok(())
}

#[cfg(coex)]
#[cfg(not(coex))]
/// Configures modem power saving
pub fn set_power_saving(&self, ps: PowerSaveMode) -> Result<(), WifiError> {
crate::wifi::apply_power_saving(ps)
8 changes: 5 additions & 3 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
@@ -61,9 +61,10 @@ 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::{
macros::ram,
@@ -2591,7 +2592,7 @@ impl<'d> WifiController<'d> {
Ok(())
}

#[cfg(coex)]
#[cfg(not(coex))]
/// Configures modem power saving
pub fn set_power_saving(&mut self, ps: PowerSaveMode) -> Result<(), WifiError> {
apply_power_saving(ps)
@@ -3264,7 +3265,8 @@ pub(crate) mod embassy {
}
}

pub(crate) fn apply_power_saving(mut ps: PowerSaveMode) -> Result<(), WifiError> {
#[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(())
}