8000 fix issue with STA emiting the wrong event · karlzheng/arduino-esp32@8332a23 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8332a23

Browse files
committed
fix issue with STA emiting the wrong event
1 parent dde5e29 commit 8332a23

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

libraries/WiFi/src/WiFiGeneric.cpp

Lines changed: 5 additions & 1 deletion
< 8000 td data-grid-cell-id="diff-0aa87997f6f48b5397f969144b34ce0ad4da8e173aee854c1cf2e1bf69ecf3aa-312-312-0" data-selected="false" role="gridcell" style="background-color:var(--bgColor-accent-muted, var(--color-accent-subtle));flex-grow:1" tabindex="-1" valign="top" class="focusable-grid-cell diff-hunk-cell left-side" colSpan="4">
@@ -313,8 +313,12 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
Original file line numberDiff line numberDiff line change
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

Lines 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

Lines 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