Skip to content

Commit 3d40dec

Browse files
committed
WiFi: allow status() to be called before begin()
1 parent 63a748f commit 3d40dec

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

libraries/SocketWrapper/WiFi.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ class WiFiClass : public NetworkInterface {
7979
return true;
8080
}
8181

82-
int status() {
83-
if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, netif, &sta_state,
84-
sizeof(struct wifi_iface_status))) {
85-
return WL_NO_SHIELD;
86-
}
82+
int status() {
83+
sta_iface = net_if_get_wifi_sta();
84+
netif = sta_iface;
85+
if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, netif, &sta_state,
86+
sizeof(struct wifi_iface_status))) {
87+
return WL_NO_SHIELD;
88+
}
8789

8890
if (sta_state.state >= WIFI_STATE_ASSOCIATED) {
8991
return WL_CONNECTED;

0 commit comments

Comments
 (0)