esp_event, mdns: fixes for CONFIG_ETH_ENABLED=n

pull/4273/head
Ivan Grokhotkov 2019-10-03 10:52:53 +02:00
rodzic 6bddcdac67
commit 569ad7545c
3 zmienionych plików z 9 dodań i 10 usunięć

Wyświetl plik

@ -17,7 +17,7 @@
#include "esp_event_legacy.h" #include "esp_event_legacy.h"
#include "esp_wifi_types.h" #include "esp_wifi_types.h"
#include "tcpip_adapter.h" #include "tcpip_adapter.h"
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_ETH_ENABLED
#include "esp_eth.h" #include "esp_eth.h"
#endif #endif
@ -38,8 +38,7 @@
* default_event_loop.c is linked, this file is #include-ed into default_event_loop.c. * 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 LOG_LOCAL_LEVEL >= 4 /* ESP_LOG_DEBUG */
#if 1
#define WITH_EVENT_DEBUG #define WITH_EVENT_DEBUG
#endif #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_STACONNECTED, sta_connected);
HANDLE_SYS_EVENT_ARG(WIFI, AP_STADISCONNECTED, sta_disconnected); HANDLE_SYS_EVENT_ARG(WIFI, AP_STADISCONNECTED, sta_disconnected);
HANDLE_SYS_EVENT_ARG(WIFI, AP_PROBEREQRECVED, ap_probereqrecved); HANDLE_SYS_EVENT_ARG(WIFI, AP_PROBEREQRECVED, ap_probereqrecved);
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_ETH_ENABLED
/* Ethernet events */ /* Ethernet events */
/* Some extra defines to fit the old naming scheme... */ /* Some extra defines to fit the old naming scheme... */
#define ETH_EVENT_ETH_START ETHERNET_EVENT_START #define ETH_EVENT_ETH_START ETHERNET_EVENT_START

Wyświetl plik

@ -3078,7 +3078,7 @@ static void _mdns_handle_system_event(esp_event_base_t event_base,
break; break;
} }
} }
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_ETH_ENABLED
else if (event_base == ETH_EVENT) { else if (event_base == ETH_EVENT) {
switch (event_id) { switch (event_id) {
case ETHERNET_EVENT_CONNECTED: 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_enable_pcb(TCPIP_ADAPTER_IF_STA, MDNS_IP_PROTOCOL_V4);
_mdns_announce_pcb(TCPIP_ADAPTER_IF_STA, MDNS_IP_PROTOCOL_V6, NULL, 0, true); _mdns_announce_pcb(TCPIP_ADAPTER_IF_STA, MDNS_IP_PROTOCOL_V6, NULL, 0, true);
break; break;
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_ETH_ENABLED
case IP_EVENT_ETH_GOT_IP: case IP_EVENT_ETH_GOT_IP:
_mdns_enable_pcb(TCPIP_ADAPTER_IF_ETH, MDNS_IP_PROTOCOL_V4); _mdns_enable_pcb(TCPIP_ADAPTER_IF_ETH, MDNS_IP_PROTOCOL_V4);
break; 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) { if ((err = esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL)) != ESP_OK) {
goto free_event_handlers; 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) { if ((err = esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL)) != ESP_OK) {
goto free_event_handlers; goto free_event_handlers;
} }
@ -4214,7 +4214,7 @@ free_all_and_disable_pcbs:
free_event_handlers: free_event_handlers:
esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler); esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler);
esp_event_handler_unregister(IP_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); esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler);
#endif #endif
vQueueDelete(_mdns_server->action_queue); vQueueDelete(_mdns_server->action_queue);
@ -4264,7 +4264,7 @@ void mdns_free(void)
vSemaphoreDelete(_mdns_server->lock); vSemaphoreDelete(_mdns_server->lock);
esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler); esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler);
esp_event_handler_unregister(IP_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); esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler);
#endif #endif
free(_mdns_server); free(_mdns_server);

Wyświetl plik

@ -21,7 +21,7 @@
#include "esp_system.h" #include "esp_system.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "esp_event.h" #include "esp_event.h"
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_ETH_ENABLED
#include "esp_eth.h" #include "esp_eth.h"
#endif #endif