Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ committed Feb 6, 2025
1 parent 9b66174 commit ce74ffb
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ impl WifiController<'_> {
/// otherwise `None`.
#[cfg(feature = "sniffer")]
pub fn take_sniffer(&self) -> Option<Sniffer> {
if self.sniffer_taken.fetch_or(true, Ordering::Acquire) == false {
if !self.sniffer_taken.fetch_or(true, Ordering::Acquire) {
Some(Sniffer::new())
} else {
None
Expand Down Expand Up @@ -2813,26 +2813,21 @@ impl WifiController<'_> {
/// wifi_controller.set_protocol(Protocol::P802D11BGNLR.into());
/// ```
pub fn set_protocol(&mut self, protocols: EnumSet<Protocol>) -> Result<(), WifiError> {
let mut protocol = 0u32;

protocols.into_iter().for_each(|v| match v {
Protocol::P802D11B => protocol |= WIFI_PROTOCOL_11B,
Protocol::P802D11BG => protocol |= WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G,
Protocol::P802D11BGN => {
protocol |= WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N
}
Protocol::P802D11BGNLR => {
protocol |=
let protocol = protocols
.into_iter()
.map(|v| match v {
Protocol::P802D11B => WIFI_PROTOCOL_11B,
Protocol::P802D11BG => WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G,
Protocol::P802D11BGN => WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N,
Protocol::P802D11BGNLR => {
WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR
}
Protocol::P802D11LR => protocol |= WIFI_PROTOCOL_LR,
Protocol::P802D11BGNAX => {
protocol |=
}
Protocol::P802D11LR => WIFI_PROTOCOL_LR,
Protocol::P802D11BGNAX => {
WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11AX
}
});

let protocol = protocol as u8;
}
})
.fold(0, |combined, protocol| combined | protocol) as u8;

let mode = self.mode()?;
if mode.is_sta() {
Expand Down

0 comments on commit ce74ffb

Please sign in to comment.