commit.
This commit is contained in:
@@ -75,7 +75,7 @@ fn main() {
|
||||
tx,
|
||||
).expect("Failed to create manager");
|
||||
|
||||
let wifi = WiFi::new();
|
||||
let wifi = WiFi::new().expect("Failed to connect wifi");
|
||||
|
||||
loop {
|
||||
match manager.handling_once() {
|
||||
|
@@ -9,9 +9,10 @@ use esp_idf_svc::{
|
||||
netif::EspNetifStack, nvs::EspDefaultNvs, sysloop::EspSysLoopStack, wifi::EspWifi
|
||||
};
|
||||
use embedded_svc::{wifi::*, ipv4};
|
||||
use embedded_svc::ping::Ping;
|
||||
use log::info;
|
||||
|
||||
use embedded_svc::ping::Ping;
|
||||
|
||||
pub struct WiFi {
|
||||
wifi: Box<EspWifi>,
|
||||
}
|
||||
@@ -22,7 +23,7 @@ impl WiFi {
|
||||
let sys_loop_stack = Arc::new(EspSysLoopStack::new()?);
|
||||
let default_nvs = Arc::new(EspDefaultNvs::new()?);
|
||||
|
||||
let mut wifi = Self::wifi(
|
||||
let wifi = Self::wifi(
|
||||
netif_stack.clone(),
|
||||
sys_loop_stack.clone(),
|
||||
default_nvs.clone(),
|
||||
@@ -44,6 +45,9 @@ impl WiFi {
|
||||
|
||||
let ap_infos = wifi.scan()?;
|
||||
|
||||
|
||||
info!("Wifi AP Count {}", ap_infos.len());
|
||||
|
||||
let ours = ap_infos.into_iter().find(|a| a.ssid == SSID);
|
||||
|
||||
let channel = if let Some(ours) = ours {
|
||||
@@ -100,7 +104,6 @@ impl WiFi {
|
||||
|
||||
fn ping(ip_settings: &ipv4::ClientSettings) -> Result<()> {
|
||||
info!("About to do some pings for {:?}", ip_settings);
|
||||
|
||||
let ping_summary =
|
||||
EspPing::default().ping(ip_settings.subnet.gateway, &Default::default())?;
|
||||
if ping_summary.transmitted != ping_summary.received {
|
||||
|
Reference in New Issue
Block a user