From bfc9845d005b361cc1ba58939c6d3317aeb37a07 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 15 Sep 2017 13:29:36 +1000 Subject: [PATCH] esp32/modnetwork: Give better error msgs for AP timeout and not-found. --- ports/esp32/modnetwork.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ports/esp32/modnetwork.c b/ports/esp32/modnetwork.c index 73a4718617..af1c9301c4 100644 --- a/ports/esp32/modnetwork.c +++ b/ports/esp32/modnetwork.c @@ -130,8 +130,16 @@ static esp_err_t event_handler(void *ctx, system_event_t *event) { system_event_sta_disconnected_t *disconn = &event->event_info.disconnected; ESP_LOGI("wifi", "STA_DISCONNECTED, reason:%d", disconn->reason); switch (disconn->reason) { + case WIFI_REASON_BEACON_TIMEOUT: + mp_printf(MP_PYTHON_PRINTER, "beacon timeout\n"); + // AP has dropped out; try to reconnect. + break; + case WIFI_REASON_NO_AP_FOUND: + mp_printf(MP_PYTHON_PRINTER, "no AP found\n"); + // AP may not exist, or it may have momentarily dropped out; try to reconnect. + break; case WIFI_REASON_AUTH_FAIL: - mp_printf(MP_PYTHON_PRINTER, "authentication failed"); + mp_printf(MP_PYTHON_PRINTER, "authentication failed\n"); wifi_sta_connected = false; break; default: