Replies: 2 comments 4 replies
-
I cannot reproduce this with either the Do you mind creating a reproducer for this? With the latest version of esp-wifi the idea is that you can have both, AP and STA interfaces but either of them might be inactive depending on what you pass into |
Beta Was this translation helpful? Give feedback.
-
I see - that code is still on 0.23.1 / 0.6.0 - back then the wifi-mode was solely inferred from how it was initialized In the current version the mode is determined by what you actually pass to Here are the changes needed to upgrade the example diff --git a/Cargo.toml b/Cargo.toml
index eacf709..c22d53f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,21 +12,21 @@ embassy-net = { version = "0.6.0", features = [
] }
embedded-io = "0.6.1"
embedded-io-async = "0.6.1"
-esp-alloc = { version = "0.6.0" }
+esp-alloc = { version = "0.7.0" }
esp-backtrace = { version = "0.15.0", features = [
"esp32s3",
"exception-handler",
"panic-handler",
"println",
] }
-esp-hal = { version = "0.23.1", features = ["esp32s3", "unstable"] }
+esp-hal = { version = "1.0.0-beta.0", features = ["esp32s3", "unstable"] }
esp-println = { version = "0.13.0", features = ["esp32s3", "log"] }
-esp-wifi = { version = "0.12.0", default-features = false, features = [
+esp-wifi = { version = "0.13.0", default-features = false, features = [
"esp-alloc",
"esp32s3",
"log",
- "utils",
"wifi",
+ "builtin-scheduler",
] }
heapless = { version = "0.8.0", default-features = false }
log = { version = "0.4.21" }
@@ -46,7 +46,7 @@ smoltcp = { version = "0.12.0", default-features = false, features = [
critical-section = "1.2.0"
embassy-executor = { version = "0.7.0", features = ["task-arena-size-20480"] }
embassy-time = { version = "0.4.0", features = ["generic-queue-8"] }
-esp-hal-embassy = { version = "0.6.0", features = ["esp32s3"] }
+esp-hal-embassy = { version = "0.7.0", features = ["esp32s3"] }
static_cell = { version = "2.1.0", features = ["nightly"] }
[profile.dev]
diff --git a/src/main.rs b/src/main.rs
index 6cc2867..eb2ebc5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,7 +8,7 @@ use embassy_net::{Config, Ipv4Cidr, Runner, Stack, StackResources, StaticConfigV
use embassy_time::{Duration, Timer};
use esp_backtrace as _;
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
-use esp_wifi::{wifi::{WifiApDevice, WifiDevice, WifiStaDevice}, EspWifiController};
+use esp_wifi::{wifi::{WifiDevice}, EspWifiController};
use log::{error, info, trace};
extern crate alloc;
@@ -34,7 +34,7 @@ async fn main(spawner: Spawner) {
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
let mut peripherals = esp_hal::init(config);
- esp_alloc::heap_allocator!(72 * 1024);
+ esp_alloc::heap_allocator!(size: 72 * 1024);
esp_println::logger::init_logger_from_env();
@@ -51,7 +51,10 @@ async fn main(spawner: Spawner) {
);
let wifi = peripherals.WIFI;
- let (wifi_ap_interface, wifi_sta_interface, controller) = esp_wifi::wifi::new_ap_sta(&init, wifi).unwrap();
+ let (controller, interfaces) = esp_wifi::wifi::new(&init, wifi).unwrap();
+
+ let wifi_ap_interface = interfaces.ap;
+ let wifi_sta_interface = interfaces.sta;
let sta_config = Config::dhcpv4(Default::default());
@@ -92,12 +95,12 @@ async fn main(spawner: Spawner) {
}
#[embassy_executor::task]
-pub async fn sta_net_task(mut runner: Runner<'static, WifiDevice<'static, WifiStaDevice>>) {
+pub async fn sta_net_task(mut runner: Runner<'static, WifiDevice<'static>>) {
runner.run().await
}
#[embassy_executor::task]
-pub async fn ap_net_task(mut runner: Runner<'static, WifiDevice<'static, WifiApDevice>>) {
+pub async fn ap_net_task(mut runner: Runner<'static, WifiDevice<'static>>) {
runner.run().await
} If you really want to stay on the previous version you would need to use the appropriate |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an application that sometimes need wifi to be sometimes on STA and sometimes AP.
Therefore I have both the
ap_runner
andsta_runner
running.I noticed, that when I configure the controller as with ClientConfiguration, I get some default
iot-device
open wifi network, and found it in the default configuration in esp-hal.I'm not in mixed configuration configuration, only client.
Is there a way to not turn it on? I guess if I disable the
ap_runner
it would disable it, but that means I'd need to add additional handshake with the runner to enable/disable it.Is there an easier way than that?
Beta Was this translation helpful? Give feedback.
All reactions