From a62675a81a83d4c2dcb91b74da3a2e394cd8f8cb Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Wed, 10 Nov 2021 22:33:44 +0530 Subject: [PATCH] fix wifi reset and monitor deinit routine --- ports/espressif/common-hal/wifi/Monitor.c | 3 +-- ports/espressif/common-hal/wifi/__init__.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/common-hal/wifi/Monitor.c b/ports/espressif/common-hal/wifi/Monitor.c index b0ce341d71..b37219d67b 100644 --- a/ports/espressif/common-hal/wifi/Monitor.c +++ b/ports/espressif/common-hal/wifi/Monitor.c @@ -102,8 +102,7 @@ void common_hal_wifi_monitor_construct(wifi_monitor_obj_t *self, uint8_t channel bool common_hal_wifi_monitor_deinited(void) { bool enabled; - esp_wifi_get_promiscuous(&enabled); - return !enabled; + return (esp_wifi_get_promiscuous(&enabled) == ESP_ERR_WIFI_NOT_INIT) ? true : !enabled; } void common_hal_wifi_monitor_deinit(wifi_monitor_obj_t *self) { diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index c349ca4b39..c926802bae 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -174,6 +174,7 @@ void wifi_reset(void) { radio->netif = NULL; esp_netif_destroy(radio->ap_netif); radio->ap_netif = NULL; + wifi_inited = false; } void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_address) {