Skip to content
Snippets Groups Projects
Commit f7998c2a authored by Gunar Schorcht's avatar Gunar Schorcht Committed by Schorcht
Browse files

cpu/esp8266: automatic reconnect in esp_wifi

parent d6664daf
No related branches found
No related tags found
No related merge requests found
...@@ -194,6 +194,20 @@ static void _esp_wifi_handle_event_cb(System_Event_t *evt) ...@@ -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) ...@@ -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;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment