From 569ad7545c32a2f1d0eff3f1e81df70fb76ad125 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 3 Oct 2019 10:52:53 +0200 Subject: [PATCH] esp_event, mdns: fixes for CONFIG_ETH_ENABLED=n --- components/esp_event/event_send_compat.inc | 7 +++---- components/mdns/mdns.c | 10 +++++----- components/mdns/private_include/mdns_networking.h | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/components/esp_event/event_send_compat.inc b/components/esp_event/event_send_compat.inc index c14630fa2b..721e8cd82b 100644 --- a/components/esp_event/event_send_compat.inc +++ b/components/esp_event/event_send_compat.inc @@ -17,7 +17,7 @@ #include "esp_event_legacy.h" #include "esp_wifi_types.h" #include "tcpip_adapter.h" -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED #include "esp_eth.h" #endif @@ -38,8 +38,7 @@ * default_event_loop.c is linked, this file is #include-ed into default_event_loop.c. */ -//#if LOG_LOCAL_LEVEL >= 4 /* ESP_LOG_DEBUG */ -#if 1 +#if LOG_LOCAL_LEVEL >= 4 /* ESP_LOG_DEBUG */ #define WITH_EVENT_DEBUG #endif @@ -90,7 +89,7 @@ esp_err_t esp_event_send_to_default_loop(system_event_t *event) HANDLE_SYS_EVENT_ARG(WIFI, AP_STACONNECTED, sta_connected); HANDLE_SYS_EVENT_ARG(WIFI, AP_STADISCONNECTED, sta_disconnected); HANDLE_SYS_EVENT_ARG(WIFI, AP_PROBEREQRECVED, ap_probereqrecved); -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED /* Ethernet events */ /* Some extra defines to fit the old naming scheme... */ #define ETH_EVENT_ETH_START ETHERNET_EVENT_START diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index e569a819d2..b383997b39 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -3078,7 +3078,7 @@ static void _mdns_handle_system_event(esp_event_base_t event_base, break; } } -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED else if (event_base == ETH_EVENT) { switch (event_id) { case ETHERNET_EVENT_CONNECTED: @@ -3103,7 +3103,7 @@ static void _mdns_handle_system_event(esp_event_base_t event_base, _mdns_enable_pcb(TCPIP_ADAPTER_IF_STA, MDNS_IP_PROTOCOL_V4); _mdns_announce_pcb(TCPIP_ADAPTER_IF_STA, MDNS_IP_PROTOCOL_V6, NULL, 0, true); break; -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED case IP_EVENT_ETH_GOT_IP: _mdns_enable_pcb(TCPIP_ADAPTER_IF_ETH, MDNS_IP_PROTOCOL_V4); break; @@ -4180,7 +4180,7 @@ esp_err_t mdns_init(void) if ((err = esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL)) != ESP_OK) { goto free_event_handlers; } -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED if ((err = esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL)) != ESP_OK) { goto free_event_handlers; } @@ -4214,7 +4214,7 @@ free_all_and_disable_pcbs: free_event_handlers: esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler); esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, &event_handler); -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler); #endif vQueueDelete(_mdns_server->action_queue); @@ -4264,7 +4264,7 @@ void mdns_free(void) vSemaphoreDelete(_mdns_server->lock); esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler); esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, &event_handler); -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler); #endif free(_mdns_server); diff --git a/components/mdns/private_include/mdns_networking.h b/components/mdns/private_include/mdns_networking.h index 174022dfd3..6b32ec7f13 100644 --- a/components/mdns/private_include/mdns_networking.h +++ b/components/mdns/private_include/mdns_networking.h @@ -21,7 +21,7 @@ #include "esp_system.h" #include "esp_timer.h" #include "esp_event.h" -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_ETH_ENABLED #include "esp_eth.h" #endif