diff options
| author | kbleeke <[email protected]> | 2023-05-03 21:49:35 +0200 |
|---|---|---|
| committer | kbleeke <[email protected]> | 2023-05-04 20:23:02 +0200 |
| commit | 0d8d8d3320ad44eda53d4ac793fb7c9fed03b63a (patch) | |
| tree | d321f990bfc694621c2c97e0fd6af5ebb8675d15 /examples | |
| parent | 733b83e44f924151035d72806b13c135bd68ba62 (diff) | |
simple error handling for join instead of looping internally
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rpi-pico-w/src/bin/tcp_server.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/rpi-pico-w/src/bin/tcp_server.rs b/examples/rpi-pico-w/src/bin/tcp_server.rs index 036f79308..9581602a7 100644 --- a/examples/rpi-pico-w/src/bin/tcp_server.rs +++ b/examples/rpi-pico-w/src/bin/tcp_server.rs | |||
| @@ -94,8 +94,15 @@ async fn main(spawner: Spawner) { | |||
| 94 | 94 | ||
| 95 | unwrap!(spawner.spawn(net_task(stack))); | 95 | unwrap!(spawner.spawn(net_task(stack))); |
| 96 | 96 | ||
| 97 | //control.join_open(env!("WIFI_NETWORK")).await; | 97 | loop { |
| 98 | control.join_wpa2(env!("WIFI_NETWORK"), env!("WIFI_PASSWORD")).await; | 98 | //control.join_open(env!("WIFI_NETWORK")).await; |
| 99 | match control.join_wpa2(env!("WIFI_NETWORK"), env!("WIFI_PASSWORD")).await { | ||
| 100 | Ok(_) => break, | ||
| 101 | Err(err) => { | ||
| 102 | info!("join failed with status={}", err.status); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | } | ||
| 99 | 106 | ||
| 100 | // And now we can use it! | 107 | // And now we can use it! |
| 101 | 108 | ||
