fix issue with STA emiting the wrong event
This commit is contained in:
parent
dde5e297c3
commit
8332a235d6
@ -313,9 +313,13 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
|
|||||||
WiFiSTAClass::_setStatus(WL_DISCONNECTED);
|
WiFiSTAClass::_setStatus(WL_DISCONNECTED);
|
||||||
} else if(event->event_id == SYSTEM_EVENT_STA_STOP) {
|
} else if(event->event_id == SYSTEM_EVENT_STA_STOP) {
|
||||||
WiFiSTAClass::_setStatus(WL_NO_SHIELD);
|
WiFiSTAClass::_setStatus(WL_NO_SHIELD);
|
||||||
|
} else if(event->event_id == SYSTEM_EVENT_STA_CONNECTED) {
|
||||||
|
WiFiSTAClass::_setStatus(WL_IDLE_STATUS);
|
||||||
} else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) {
|
} else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) {
|
||||||
|
if(WiFiSTAClass::status() == WL_IDLE_STATUS) {
|
||||||
WiFiSTAClass::_setStatus(WL_CONNECTED);
|
WiFiSTAClass::_setStatus(WL_CONNECTED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(uint32_t i = 0; i < cbEventList.size(); i++) {
|
for(uint32_t i = 0; i < cbEventList.size(); i++) {
|
||||||
WiFiEventCbList_t entry = cbEventList[i];
|
WiFiEventCbList_t entry = cbEventList[i];
|
||||||
|
@ -358,7 +358,7 @@ uint8_t WiFiSTAClass::waitForConnectResult()
|
|||||||
return WL_DISCONNECTED;
|
return WL_DISCONNECTED;
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(status() >= WL_DISCONNECTED && i++ < 100) {
|
while((!status() || status() >= WL_DISCONNECTED) && i++ < 100) {
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
return status();
|
return status();
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
bool setHostname(const char * hostname);
|
bool setHostname(const char * hostname);
|
||||||
|
|
||||||
// STA WiFi info
|
// STA WiFi info
|
||||||
wl_status_t status();
|
static wl_status_t status();
|
||||||
String SSID() const;
|
String SSID() const;
|
||||||
String psk() const;
|
String psk() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user