diff --git a/.cargo/config.toml b/.cargo/config.toml index c4c6c6a..d07ae7e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -31,5 +31,5 @@ build-std = ["std", "panic_abort"] # Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF stable (v4.4) #ESP_IDF_VERSION = { value = "branch:release/v4.4" } # Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF master (mainline) -ESP_IDF_VERSION = { value = "master" } +ESP_IDF_VERSION = { value = "branch:release/v4.4" } diff --git a/Cargo.toml b/Cargo.toml index 8efccd8..aa90533 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,15 +16,15 @@ opt-level = "z" pio = ["esp-idf-sys/pio"] [dependencies] -anyhow = {version = "1.0.57", features = ["backtrace"]} +anyhow = "1" embedded-graphics = "0.7.1" embedded-hal = "1.0.0-alpha.8" embedded-hal-0-2 = {package = "embedded-hal", version = "0.2.7", features = ["unproven"]} -embedded-svc = "0.21.3" +embedded-svc = "0.22.0" env_logger = "0.9.0" -esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf-hal", branch="master" } -esp-idf-svc = { git = "https://github.com/IvanLi-CN/esp-idf-svc", branch="master" } -esp-idf-sys = {version = "0.31.5", features = ["binstart"]} +esp-idf-hal = "0.38.0" +esp-idf-svc = "0.42.1" +esp-idf-sys = { version = "0.31.6", features = ["binstart"] } log = "0.4.17" retry = "1.3.1" ssd1306 = "0.7.0" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 688f1c0..271800c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,2 @@ [toolchain] - -channel = "nightly-2022-06-03" \ No newline at end of file +channel = "nightly" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 66c9096..ea4d027 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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() { diff --git a/src/wifi.rs b/src/wifi.rs index d6bad3a..3513d79 100644 --- a/src/wifi.rs +++ b/src/wifi.rs @@ -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, } @@ -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 {