From 66efed5ba5ab7d9fdf94868d76300fbedde66de5 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 15 Dec 2022 15:49:58 -0500 Subject: [PATCH] fix AuthMode printing regression --- ports/espressif/common-hal/wifi/Network.c | 4 ++-- ports/raspberrypi/common-hal/wifi/Network.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/espressif/common-hal/wifi/Network.c b/ports/espressif/common-hal/wifi/Network.c index 5c9852a1f7..9a20decd4a 100644 --- a/ports/espressif/common-hal/wifi/Network.c +++ b/ports/espressif/common-hal/wifi/Network.c @@ -86,9 +86,9 @@ mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { } mp_obj_t authmode_list = mp_obj_new_list(0, NULL); if (authmode_mask != 0) { - for (uint8_t i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 32; i++) { if ((authmode_mask >> i) & 1) { - mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, i)); + mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, 1 << i)); } } } diff --git a/ports/raspberrypi/common-hal/wifi/Network.c b/ports/raspberrypi/common-hal/wifi/Network.c index e9b64ffd2c..ef81247712 100644 --- a/ports/raspberrypi/common-hal/wifi/Network.c +++ b/ports/raspberrypi/common-hal/wifi/Network.c @@ -53,7 +53,7 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { } mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { - uint8_t authmode_mask = 0; + uint32_t authmode_mask = 0; if (self->record.auth_mode == 0) { authmode_mask = AUTHMODE_OPEN; } @@ -71,9 +71,9 @@ mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { ; mp_obj_t authmode_list = mp_obj_new_list(0, NULL); if (authmode_mask != 0) { - for (uint8_t i = 0; i < 8; i++) { + for (uint32_t i = 0; i < 32; i++) { if ((authmode_mask >> i) & 1) { - mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, i)); + mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, 1 << i)); } } }