From 266b0c38891db60e5188bffcac9d97950008fe87 Mon Sep 17 00:00:00 2001 From: Jari Jokinen Date: Sun, 5 Apr 2020 23:19:33 +0300 Subject: [PATCH 1/2] Fix instance names for event handler unregister Signed-off-by: ronghulin Merges https://github.com/espressif/esp-idf/pull/5064 --- .../wifi/getting_started/station/main/station_example_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/wifi/getting_started/station/main/station_example_main.c b/examples/wifi/getting_started/station/main/station_example_main.c index e4e030dbcc..91025bd5dd 100644 --- a/examples/wifi/getting_started/station/main/station_example_main.c +++ b/examples/wifi/getting_started/station/main/station_example_main.c @@ -120,8 +120,8 @@ void wifi_init_sta(void) ESP_LOGE(TAG, "UNEXPECTED EVENT"); } - ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_any_id)); - ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_got_ip)); + ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip)); + ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id)); vEventGroupDelete(s_wifi_event_group); } From f0744184f52cff58f4acf9c6798623cfa471cc55 Mon Sep 17 00:00:00 2001 From: ronghulin Date: Tue, 7 Apr 2020 21:53:50 +0800 Subject: [PATCH 2/2] fix: add event unregister comment --- .../wifi/getting_started/station/main/station_example_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/wifi/getting_started/station/main/station_example_main.c b/examples/wifi/getting_started/station/main/station_example_main.c index 91025bd5dd..f4f91db698 100644 --- a/examples/wifi/getting_started/station/main/station_example_main.c +++ b/examples/wifi/getting_started/station/main/station_example_main.c @@ -120,6 +120,7 @@ void wifi_init_sta(void) ESP_LOGE(TAG, "UNEXPECTED EVENT"); } + /* The event will not be processed after unregister */ ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip)); ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id)); vEventGroupDelete(s_wifi_event_group);