From 1108ff0a97d6417cd1f25286edcb603ecf75bd63 Mon Sep 17 00:00:00 2001 From: Drath Date: Fri, 19 Jun 2026 13:26:33 +0200 Subject: [PATCH] gate ethernet behind soc support --- network.c | 10 ++++++++-- network.h | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/network.c b/network.c index b497a4d..9e7bfab 100644 --- a/network.c +++ b/network.c @@ -1,14 +1,18 @@ #include "network.h" -#include #include #include #include #include #include -#include #include + +#if SOC_EMAC_SUPPORTED +#include +#include #include +#endif + ESP_EVENT_DEFINE_BASE(SNTP_EVENT); @@ -118,6 +122,7 @@ static void on_scan_done(void *arg, esp_event_base_t event_base, int32_t event_i try_next_hidden_network(); } +#if SOC_EMAC_SUPPORTED void init_ethernet(const char *hostname) { ESP_ERROR_CHECK(esp_netif_init()); @@ -139,6 +144,7 @@ void init_ethernet(const char *hostname) { ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &on_get_ip, nullptr)); ESP_ERROR_CHECK(esp_eth_start(eth_handles[0])); } +#endif void init_wifi(const struct wifi_networks_t *nets, const char *hostname) { nvs_flash_init(); diff --git a/network.h b/network.h index ec5108b..5ba992a 100644 --- a/network.h +++ b/network.h @@ -2,6 +2,7 @@ #define NETWORK_H #include +#include #define POSIX_TIMEZONE_STRING "CET-1CEST,M3.5.0,M10.5.0/3" #define SNTP_TIME_SYNC_INTERVAL_MINUTES (6 * 60) // 6 hours @@ -26,6 +27,9 @@ struct wifi_networks_t { }; void init_wifi(const struct wifi_networks_t *nets, const char *hostname); + +#if SOC_EMAC_SUPPORTED void init_ethernet(const char *hostname); +#endif #endif \ No newline at end of file