Skip to content

Commit b59a4f1

Browse files
committed
WiFi: allow status() to be called before begin()
1 parent af8b9db commit b59a4f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libraries/SocketWrapper/WiFi.h

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

82-
int status() {
83-
struct wifi_iface_status status = {0};
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+
}
8489

8590
if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, netif, &status,
8691
sizeof(struct wifi_iface_status))) {

0 commit comments

Comments
 (0)