From 5fa1b8bc2672627e354c5e04e9374e58a3e075df Mon Sep 17 00:00:00 2001 From: umgefahren <55623006+umgefahren@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:12:42 +0100 Subject: [PATCH] Fix the example --- cyw43/src/structs.rs | 7 ++----- examples/rp/src/bin/wifi_scan.rs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cyw43/src/structs.rs b/cyw43/src/structs.rs index 81b1d077..749970f1 100644 --- a/cyw43/src/structs.rs +++ b/cyw43/src/structs.rs @@ -516,7 +516,7 @@ pub struct BssInfo { pub bssid: [u8; 6], pub beacon_period: u16, pub capability: u16, - pub ssid: heapless::String<32>, + pub ssid: heapless::Vec, pub rssi: i16, pub security: BssSecurity, } @@ -573,10 +573,7 @@ impl BssInfo { 0 => BssSecurity::Open, _ => BssSecurity::None, }; - let ssid = heapless::String::from_utf8( - heapless::Vec::from_slice(&bss_info.ssid[..bss_info.ssid_len as usize]).unwrap(), - ) - .ok()?; + let ssid = heapless::Vec::from_slice(&bss_info.ssid[..bss_info.ssid_len as usize]).unwrap(); let BssInfoInternal { version, length, diff --git a/examples/rp/src/bin/wifi_scan.rs b/examples/rp/src/bin/wifi_scan.rs index 7adf52b8..a620807f 100644 --- a/examples/rp/src/bin/wifi_scan.rs +++ b/examples/rp/src/bin/wifi_scan.rs @@ -65,7 +65,7 @@ async fn main(spawner: Spawner) { .set_power_management(cyw43::PowerManagementMode::PowerSave) .await; - let mut scanner = control.scan().await; + let mut scanner = control.scan(Default::default()).await; while let Some(bss) = scanner.next().await { if let Ok(ssid_str) = str::from_utf8(&bss.ssid) { info!("scanned {} == {:x}", ssid_str, bss.bssid);