Skip to content

Commit

Permalink
Merge branch 'esp32_network_status' into OWL_v1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorNehrutsa committed Nov 14, 2023
2 parents 028bab3 + 984e824 commit 51e1064
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ports/esp32/network_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,14 @@ STATIC mp_obj_t network_wlan_status(size_t n_args, const mp_obj_t *args) {
if (wifi_sta_connected) {
// Happy path, connected with IP
return MP_OBJ_NEW_SMALL_INT(STAT_GOT_IP);
} else if ((wifi_sta_disconn_reason == WIFI_REASON_NO_AP_FOUND) || (wifi_sta_disconn_reason == WIFI_REASON_AUTH_FAIL)) {
return MP_OBJ_NEW_SMALL_INT(wifi_sta_disconn_reason);
} else if (wifi_sta_disconn_reason == WIFI_REASON_CONNECTION_FAIL) {
} else if (wifi_sta_disconn_reason == WIFI_REASON_NO_AP_FOUND) {
return MP_OBJ_NEW_SMALL_INT(WIFI_REASON_NO_AP_FOUND);
} else if ((wifi_sta_disconn_reason == WIFI_REASON_AUTH_FAIL) || (wifi_sta_disconn_reason == WIFI_REASON_CONNECTION_FAIL)) {
// wrong password
return MP_OBJ_NEW_SMALL_INT(WIFI_REASON_AUTH_FAIL);
} else if (wifi_sta_disconn_reason == WIFI_REASON_ASSOC_LEAVE) {
// After wlan.disconnect()
return MP_OBJ_NEW_SMALL_INT(STAT_IDLE);
} else if (wifi_sta_connect_requested
&& (conf_wifi_sta_reconnects == 0
|| wifi_sta_reconnects < conf_wifi_sta_reconnects)) {
Expand Down

0 comments on commit 51e1064

Please sign in to comment.