Exclude from non ESP32 devices

This commit is contained in:
Rapsssito
2026-05-19 09:20:08 +02:00
parent 028a54422e
commit 1332ebe729
3 changed files with 8 additions and 8 deletions

View File

@@ -226,8 +226,12 @@ async def to_code(config):
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY")
if CORE.is_rp2040:
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6")
CORE.add_job(network_component_to_code, config)
# Pvariable creation lives in a separate coroutine at NETWORK_SERVICES so it
# emits after wifi/ethernet at COMMUNICATION. This keeps compile-time config
# (above) separate from C++ object lifecycle and allows wiring in interface
# pointers via get_variable().
if CORE.is_esp32:
CORE.add_job(network_component_to_code, config)
@coroutine_with_priority(CoroPriority.NETWORK_SERVICES)

View File

@@ -1,20 +1,17 @@
#include "network_component.h"
#include "esphome/core/defines.h"
#ifdef USE_NETWORK
#if defined(USE_NETWORK) && defined(USE_ESP32)
#include "esphome/core/log.h"
#ifdef USE_ESP32
#include "esp_err.h"
#include "esp_netif.h"
#include "esp_event.h"
#endif
namespace esphome::network {
static const char *const TAG = "network";
void NetworkComponent::setup() {
// Initialize ESP-IDF network interfaces and ensure the default event loop exists
#ifdef USE_ESP32
esp_err_t err;
err = esp_netif_init();
if (err != ESP_OK) {
@@ -30,7 +27,6 @@ void NetworkComponent::setup() {
this->mark_failed();
return;
}
#endif
}
} // namespace esphome::network

View File

@@ -1,6 +1,6 @@
#pragma once
#include "esphome/core/defines.h"
#ifdef USE_NETWORK
#if defined(USE_NETWORK) && defined(USE_ESP32)
#include "esphome/core/component.h"
namespace esphome::network {