We added a wifi deinit to try and circumvent the disconnect loop.
Code: Select all
static void reinit_wifi(void *param)
{
ESP_LOGD(TAG, "Stop, Deinit Wifi");
ESP_ERROR_CHECK(esp_wifi_stop());
ESP_ERROR_CHECK(esp_wifi_deinit());
ESP_LOGD(TAG, "Init, Start Wifi");
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_FLASH));
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start());
esp_wifi_set_ps(WIFI_PS_NONE); // Disable powersave
ESP_LOGD(TAG, "Restart Wifi Done");
vTaskDelete(NULL);
}
This function is started as a task, after 10 consecutive disconnects.
We tested this function by restarting the router. This caused 10 consecutive disconnects and then the ESP32 reconnected to the router and the internet. See log:
https://pastebin.com/hXNHGPj3
This build ran from 21-6-2017 17:30 till 23-6-2017 on a DOIT and a LoPy
The disconnect loop occurred three times on both devices.
LoPy:
https://pastebin.com/DKv9mxZX
DOIT:
https://pastebin.com/0GTry5km
The disconnect loops and subsequent crashes occurred on 6 different times. These are the last time marks in the log files before the crash:
Code: Select all
DOIT
I (14567551) Statistics: [21-06-17 20:06:56Z] Uptime: 000.04:02:38 IPv4: 10.0.2.251 Free Heap: 17140 Temperature: 75
I (9736161) Statistics: [22-06-17 16:21:57Z] Uptime: 000.02:42:07 IPv4: 10.0.2.251 Free Heap: 75276 Temperature: 76
I (7312241) Statistics: [22-06-17 18:25:33Z] Uptime: 000.02:01:43 IPv4: 10.0.2.251 Free Heap: 75948 Temperature: 75
Code: Select all
LoPy
I (23643342) Statistics: [21-06-17 22:09:54Z] Uptime: 000.06:33:54 IPv4: 10.0.2.250 Free Heap: 55524 Temperature: 41
I (4682685) Statistics: [22-06-17 01:18:33Z] Uptime: 000.01:17:53 IPv4: 10.0.2.250 Free Heap: 62288 Temperature: 41
I (12137265) Statistics: [22-06-17 23:27:11Z] Uptime: 000.03:22:07 IPv4: 10.0.2.250 Free Heap: 75264 Temperature: 41
It seems
I (81906) wifi: ap_probe_send over, resett wifi status to disassoc also occurs when resetting the router.