aqandu / airu-v2-fw

MIT License
1 stars 2 forks source link

[Web App]: HTTP Server crashes on WiFi AP Scan #2

Closed aqandu closed 5 years ago

aqandu commented 5 years ago

When the board powers on sometimes it crashes while trying to scan for WiFi networks. I don't know when or why.

aqandu commented 5 years ago

Found out why and when.

WHY:

In wifi_manager.c, around line 715, when it does the scan:

ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, true));

if the WIFI_MANAGER_STA_DISCONNECT_BIT bit is still high, meaning the NWP is still trying to connect to a station, then the scan fails (TIMEOUT). We must wait for the wifi callback to catch the bit and disconnect before scanning.

WHEN:

if the WiFi profile saved on the ESP cannot be connected to. I guess it tries and maybe keeps trying? And that's why the disconnect never happens.

Reference: https://www.esp32.com/viewtopic.php?t=7600

tbec commented 5 years ago

Fixed it. Changed the timeout (or something, I can't remember what I did... o_0)