cpu/esp8266: automatic reconnect in esp_wifi
This commit is contained in:
parent
d6664dafad
commit
f7998c2ad6
@ -194,6 +194,20 @@ static void _esp_wifi_handle_event_cb(System_Event_t *evt)
|
|||||||
evt->event_info.disconnected.ssid,
|
evt->event_info.disconnected.ssid,
|
||||||
evt->event_info.disconnected.reason);
|
evt->event_info.disconnected.reason);
|
||||||
_esp_wifi_dev.connected = false;
|
_esp_wifi_dev.connected = false;
|
||||||
|
|
||||||
|
/* call disconnect to reset internal state */
|
||||||
|
if (!wifi_station_disconnect()) {
|
||||||
|
ESP_WIFI_LOG_ERROR("could not disconnect from to AP %s",
|
||||||
|
ESP_WIFI_SSID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* try to reconnect */
|
||||||
|
if (!wifi_station_connect()) {
|
||||||
|
ESP_WIFI_LOG_ERROR("could not start connection to AP %s",
|
||||||
|
ESP_WIFI_SSID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -523,7 +537,7 @@ static void _esp_wifi_setup(void)
|
|||||||
|
|
||||||
/* connect */
|
/* connect */
|
||||||
if (!wifi_station_connect()) {
|
if (!wifi_station_connect()) {
|
||||||
ESP_WIFI_DEBUG("could not start connection to AP %s", ESP_WIFI_SSID);
|
ESP_WIFI_LOG_ERROR("could not start connection to AP %s", ESP_WIFI_SSID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user