From 1ed909ea74bfff75bd91b35739a44c5128271571 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 21 Jun 2023 19:08:09 +0200 Subject: [PATCH] esp-hosted: fix warnings. --- embassy-net-esp-hosted/src/control.rs | 14 ++------------ embassy-net-esp-hosted/src/ioctl.rs | 4 ++-- embassy-net-esp-hosted/src/lib.rs | 5 +++-- examples/nrf52840/src/bin/wifi_esp_hosted.rs | 1 - 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs index a2a65bc31..fce82ade7 100644 --- a/embassy-net-esp-hosted/src/control.rs +++ b/embassy-net-esp-hosted/src/control.rs @@ -16,6 +16,7 @@ pub struct Control<'a> { shared: &'a Shared, } +#[allow(unused)] enum WifiMode { None = 0, Sta = 1, @@ -34,6 +35,7 @@ impl<'a> Control<'a> { debug!("set wifi mode"); self.set_wifi_mode(WifiMode::Sta as _).await; + let mac_addr = self.get_mac_addr().await; debug!("mac addr: {:02x}", mac_addr); self.state_ch.set_ethernet_address(mac_addr); @@ -91,18 +93,6 @@ impl<'a> Control<'a> { res } - async fn get_wifi_mode(&mut self) -> u32 { - let req = proto::CtrlMsg { - msg_id: proto::CtrlMsgId::ReqGetWifiMode as _, - msg_type: proto::CtrlMsgType::Req as _, - payload: Some(proto::CtrlMsgPayload::ReqGetWifiMode(proto::CtrlMsgReqGetMode {})), - }; - let resp = self.ioctl(req).await; - let proto::CtrlMsgPayload::RespGetWifiMode(resp) = resp.payload.unwrap() else { panic!("unexpected resp") }; - assert_eq!(resp.resp, 0); - resp.mode - } - async fn set_wifi_mode(&mut self, mode: u32) { let req = proto::CtrlMsg { msg_id: proto::CtrlMsgId::ReqSetWifiMode as _, diff --git a/embassy-net-esp-hosted/src/ioctl.rs b/embassy-net-esp-hosted/src/ioctl.rs index 607b7b627..e2a6815aa 100644 --- a/embassy-net-esp-hosted/src/ioctl.rs +++ b/embassy-net-esp-hosted/src/ioctl.rs @@ -1,6 +1,6 @@ -use core::cell::{Cell, RefCell}; +use core::cell::RefCell; use core::future::poll_fn; -use core::task::{Poll, Waker}; +use core::task::Poll; use embassy_sync::waitqueue::WakerRegistration; diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index ff7bed2b7..2a4601ce4 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs @@ -83,6 +83,7 @@ struct PayloadHeader { } impl_bytes!(PayloadHeader); +#[allow(unused)] #[repr(u8)] enum InterfaceType { Sta = 0, @@ -276,7 +277,7 @@ where return; } - let isEvent = match &payload[..12] { + let is_event = match &payload[..12] { b"\x01\x08\x00ctrlResp\x02" => false, b"\x01\x08\x00ctrlEvnt\x02" => true, _ => { @@ -292,7 +293,7 @@ where } let data = &payload[14..][..len]; - if isEvent { + if is_event { self.handle_event(data); } else { self.shared.ioctl_done(data); diff --git a/examples/nrf52840/src/bin/wifi_esp_hosted.rs b/examples/nrf52840/src/bin/wifi_esp_hosted.rs index b75756f76..cea45c5c8 100644 --- a/examples/nrf52840/src/bin/wifi_esp_hosted.rs +++ b/examples/nrf52840/src/bin/wifi_esp_hosted.rs @@ -10,7 +10,6 @@ use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; use embassy_nrf::rng::Rng; use embassy_nrf::spim::{self, Spim}; use embassy_nrf::{bind_interrupts, peripherals}; -use embassy_time::{Duration, Timer}; use embedded_hal_async::spi::ExclusiveDevice; use embedded_io::asynch::Write; use static_cell::make_static;