aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George2017-09-15 13:29:36 +1000
committerDamien George2017-12-13 14:48:53 +1100
commitbfc9845d005b361cc1ba58939c6d3317aeb37a07 (patch)
treea1189b9668443d8b6e6accf1f7e50802389ce75e
parentbc08c884a2e7d1d3a4476c224f230b90ee2bf1e3 (diff)
esp32/modnetwork: Give better error msgs for AP timeout and not-found.
-rw-r--r--ports/esp32/modnetwork.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ports/esp32/modnetwork.c b/ports/esp32/modnetwork.c
index 73a471861..af1c9301c 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: