Skip to content

Commit 0d183d7

Browse files
committed
esp32/modnetwork: Give better error msgs for AP timeout and not-found.
1 parent f0561ab commit 0d183d7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ports/esp32/modnetwork.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,16 @@ static esp_err_t event_handler(void *ctx, system_event_t *event) {
130130
system_event_sta_disconnected_t *disconn = &event->event_info.disconnected;
131131
ESP_LOGI("wifi", "STA_DISCONNECTED, reason:%d", disconn->reason);
132132
switch (disconn->reason) {
133+
case WIFI_REASON_BEACON_TIMEOUT:
134+
mp_printf(MP_PYTHON_PRINTER, "beacon timeout\n");
135+
// AP has dropped out; try to reconnect.
136+
break;
137+
case WIFI_REASON_NO_AP_FOUND:
138+
mp_printf(MP_PYTHON_PRINTER, "no AP found\n");
139+
// AP may not exist, or it may have momentarily dropped out; try to reconnect.
140+
break;
133141
case WIFI_REASON_AUTH_FAIL:
134-
mp_printf(MP_PYTHON_PRINTER, "authentication failed");
142+
mp_printf(MP_PYTHON_PRINTER, "authentication failed\n");
135143
wifi_sta_connected = false;
136144
break;
137145
default:

0 commit comments

Comments
 (0)