Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8332a23

Browse filesBrowse files
committed
fix issue with STA emiting the wrong event
1 parent dde5e29 commit 8332a23
Copy full SHA for 8332a23

File tree

Expand file treeCollapse file tree

3 files changed

+7
-3
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-3
lines changed

‎libraries/WiFi/src/WiFiGeneric.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiGeneric.cpp
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,12 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
313313
WiFiSTAClass::_setStatus(WL_DISCONNECTED);
314314
} else if(event->event_id == SYSTEM_EVENT_STA_STOP) {
315315
WiFiSTAClass::_setStatus(WL_NO_SHIELD);
316+
} else if(event->event_id == SYSTEM_EVENT_STA_CONNECTED) {
317+
WiFiSTAClass::_setStatus(WL_IDLE_STATUS);
316318
} else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) {
317-
WiFiSTAClass::_setStatus(WL_CONNECTED);
319+
if(WiFiSTAClass::status() == WL_IDLE_STATUS) {
320+
WiFiSTAClass::_setStatus(WL_CONNECTED);
321+
}
318322
}
319323

320324
for(uint32_t i = 0; i < cbEventList.size(); i++) {

‎libraries/WiFi/src/WiFiSTA.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiSTA.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ uint8_t WiFiSTAClass::waitForConnectResult()
358358
return WL_DISCONNECTED;
359359
}
360360
int i = 0;
361-
while(status() >= WL_DISCONNECTED && i++ < 100) {
361+
while((!status() || status() >= WL_DISCONNECTED) && i++ < 100) {
362362
delay(100);
363363
}
364364
return status();

‎libraries/WiFi/src/WiFiSTA.h

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiSTA.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class WiFiSTAClass
7272
bool setHostname(const char * hostname);
7373

7474
// STA WiFi info
75-
wl_status_t status();
75+
static wl_status_t status();
7676
String SSID() const;
7777
String psk() const;
7878

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.