commit.
This commit is contained in:
parent
7ef35692c9
commit
12f3509304
@ -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" }
|
||||
|
||||
|
10
Cargo.toml
10
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"
|
||||
|
@ -1,3 +1,2 @@
|
||||
[toolchain]
|
||||
|
||||
channel = "nightly-2022-06-03"
|
||||
channel = "nightly"
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user