switched to a dedicated AP

This commit is contained in:
Andy Killorin 2024-12-07 15:24:45 -05:00
parent 357437b36c
commit 9fdd219fb8
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
3 changed files with 16 additions and 6 deletions

View file

@ -11,6 +11,7 @@ use core::panic::PanicInfo;
use core::str::from_utf8; use core::str::from_utf8;
use bt_hci::cmd::info; use bt_hci::cmd::info;
use cyw43::JoinOptions;
use cyw43_pio::PioSpi; use cyw43_pio::PioSpi;
use embassy_rp::pwm::{self, Pwm}; use embassy_rp::pwm::{self, Pwm};
use fixed::FixedU16; use fixed::FixedU16;
@ -109,12 +110,12 @@ async fn main(spawner: Spawner) {
control.init(clm).await; control.init(clm).await;
control control
.set_power_management(cyw43::PowerManagementMode::PowerSave) .set_power_management(cyw43::PowerManagementMode::Performance)
.await; .await;
// Use a link-local address for communication without DHCP server // Use a link-local address for communication without DHCP server
let config = Config::ipv4_static(embassy_net::StaticConfigV4 { let config = Config::ipv4_static(embassy_net::StaticConfigV4 {
address: embassy_net::Ipv4Cidr::new(embassy_net::Ipv4Address::new(169, 254, 1, 1), 16), address: embassy_net::Ipv4Cidr::new(embassy_net::Ipv4Address::new(192, 168, 0, 10), 24),
dns_servers: heapless::Vec::new(), dns_servers: heapless::Vec::new(),
gateway: None, gateway: None,
}); });
@ -128,8 +129,17 @@ async fn main(spawner: Spawner) {
defmt::unwrap!(spawner.spawn(net_task(runner))); defmt::unwrap!(spawner.spawn(net_task(runner)));
//control.start_ap_open("door409", 5).await; loop {
control.start_ap_wpa2("door409", "babelite", 5).await; match control
.await
{
Ok(_) => break,
Err(err) => {
info!("join failed with status={}", err.status);
}
}
}
let mut rx_buffer = [0; 4096]; let mut rx_buffer = [0; 4096];
let mut tx_buffer = [0; 4096]; let mut tx_buffer = [0; 4096];

View file

@ -111,7 +111,7 @@ async fn main(spawner: Spawner) {
// Use a link-local address for communication without DHCP server // Use a link-local address for communication without DHCP server
let config = Config::ipv4_static(embassy_net::StaticConfigV4 { let config = Config::ipv4_static(embassy_net::StaticConfigV4 {
address: embassy_net::Ipv4Cidr::new(embassy_net::Ipv4Address::new(169, 254, 2, 1), 16), address: embassy_net::Ipv4Cidr::new(embassy_net::Ipv4Address::new(192, 168, 0, 12), 24),
dns_servers: heapless::Vec::new(), dns_servers: heapless::Vec::new(),
gateway: None, gateway: None,
}); });

View file

@ -41,7 +41,7 @@ pub async fn wiggle_manager(pwm: PWM_SLICE5, head: PIN_26, tail: PIN_27) -> ! {
c.compare_b = 6248; c.compare_b = 6248;
pwm.set_config(&c); pwm.set_config(&c);
Timer::after_millis(50).await; Timer::after_millis(500).await;
LOCKOUT.store(false, core::sync::atomic::Ordering::SeqCst); LOCKOUT.store(false, core::sync::atomic::Ordering::SeqCst);
} }