Skip to content

Commit

Permalink
Make environment variable WIFI_NETWORK optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Sep 5, 2022
1 parent 1190f01 commit 069fe28
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions boards/rp-pico-w/examples/pico_w_blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,16 @@ async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::Sta
let net_device = control.init(clm).await;
info!("init net net device done");

if option_env!("WIFI_PASSWORD").is_some() {
control
.join_wpa2(env!("WIFI_NETWORK"), option_env!("WIFI_PASSWORD").unwrap())
.await;
if option_env!("WIFI_NETWORK").is_some() {
if option_env!("WIFI_PASSWORD").is_some() {
control
.join_wpa2(option_env!("WIFI_NETWORK").unwrap(), option_env!("WIFI_PASSWORD").unwrap())
.await;
} else {
control.join_open(option_env!("WIFI_NETWORK").unwrap()).await;
}
} else {
control.join_open(env!("WIFI_NETWORK")).await;
warn!("Environment variable WIFI_NETWORK not set during compilation - not joining wireless network");
}
let config = embassy_net::ConfigStrategy::Dhcp;
//let config = embassy_net::ConfigStrategy::Static(embassy_net::Config {
Expand Down

0 comments on commit 069fe28

Please sign in to comment.