mirror of
https://github.com/esphome/esphome.git
synced 2026-01-08 19:20:51 -07:00
[async_tcp] Fix build conflicts and use IDF component for ESP32 (#13025)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
@@ -1 +1 @@
|
|||||||
97fb425f1d681a5994ed1cc6187910f5d2c37ee577b6dc07eb3f4d8862a011de
|
191a0e6ab5842d153dd77a2023bc5742f9d4333c334de8d81b57f2b8d4d4b65e
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ CONFIG_SCHEMA = cv.Schema({})
|
|||||||
|
|
||||||
@coroutine_with_priority(CoroPriority.NETWORK_TRANSPORT)
|
@coroutine_with_priority(CoroPriority.NETWORK_TRANSPORT)
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
if CORE.using_esp_idf:
|
if CORE.is_esp32:
|
||||||
# ESP-IDF needs the IDF component
|
# https://github.com/ESP32Async/AsyncTCP
|
||||||
from esphome.components.esp32 import add_idf_component
|
from esphome.components.esp32 import add_idf_component
|
||||||
|
|
||||||
add_idf_component(name="esp32async/asynctcp", ref="3.4.91")
|
add_idf_component(name="esp32async/asynctcp", ref="3.4.91")
|
||||||
elif CORE.is_esp32 or CORE.is_libretiny:
|
elif CORE.is_libretiny:
|
||||||
# https://github.com/ESP32Async/AsyncTCP
|
# https://github.com/ESP32Async/AsyncTCP
|
||||||
cg.add_library("ESP32Async/AsyncTCP", "3.4.5")
|
cg.add_library("ESP32Async/AsyncTCP", "3.4.5")
|
||||||
elif CORE.is_esp8266:
|
elif CORE.is_esp8266:
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
|
||||||
#if (defined(USE_ESP32) || defined(USE_LIBRETINY)) && !defined(CLANG_TIDY)
|
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
||||||
// Use AsyncTCP library for ESP32 (Arduino or ESP-IDF) and LibreTiny
|
// Use AsyncTCP library for ESP32 (Arduino or ESP-IDF) and LibreTiny
|
||||||
// But not for clang-tidy as the header file isn't present in that case
|
|
||||||
#include <AsyncTCP.h>
|
#include <AsyncTCP.h>
|
||||||
#elif defined(USE_ESP8266)
|
#elif defined(USE_ESP8266)
|
||||||
// Use ESPAsyncTCP library for ESP8266 (always Arduino)
|
// Use ESPAsyncTCP library for ESP8266 (always Arduino)
|
||||||
@@ -12,6 +11,6 @@
|
|||||||
// Use AsyncTCP_RP2040W library for RP2040
|
// Use AsyncTCP_RP2040W library for RP2040
|
||||||
#include <AsyncTCP_RP2040W.h>
|
#include <AsyncTCP_RP2040W.h>
|
||||||
#else
|
#else
|
||||||
// Use socket-based implementation for other platforms and clang-tidy
|
// Use socket-based implementation for other platforms
|
||||||
#include "async_tcp_socket.h"
|
#include "async_tcp_socket.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "async_tcp_socket.h"
|
#include "async_tcp_socket.h"
|
||||||
|
|
||||||
#if defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
|
#if !defined(USE_ESP32) && !defined(USE_ESP8266) && !defined(USE_RP2040) && !defined(USE_LIBRETINY) && \
|
||||||
|
(defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS))
|
||||||
|
|
||||||
#include "esphome/components/network/util.h"
|
#include "esphome/components/network/util.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
@@ -158,4 +159,4 @@ void AsyncClient::loop() {
|
|||||||
|
|
||||||
} // namespace esphome::async_tcp
|
} // namespace esphome::async_tcp
|
||||||
|
|
||||||
#endif // defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
|
#endif
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
|
||||||
#if defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
|
#if !defined(USE_ESP32) && !defined(USE_ESP8266) && !defined(USE_RP2040) && !defined(USE_LIBRETINY) && \
|
||||||
|
(defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS))
|
||||||
|
|
||||||
#include "esphome/components/socket/socket.h"
|
#include "esphome/components/socket/socket.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -69,5 +70,4 @@ class AsyncClient {
|
|||||||
|
|
||||||
// Expose AsyncClient in global namespace to match library behavior
|
// Expose AsyncClient in global namespace to match library behavior
|
||||||
using esphome::async_tcp::AsyncClient; // NOLINT(google-global-names-in-headers)
|
using esphome::async_tcp::AsyncClient; // NOLINT(google-global-names-in-headers)
|
||||||
#define ESPHOME_ASYNC_TCP_SOCKET_IMPL
|
#endif
|
||||||
#endif // defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
|
|
||||||
|
|||||||
@@ -31,3 +31,5 @@ dependencies:
|
|||||||
version: 0.2.2
|
version: 0.2.2
|
||||||
rules:
|
rules:
|
||||||
- if: "target in [esp32, esp32s2, esp32s3, esp32p4]"
|
- if: "target in [esp32, esp32s2, esp32s3, esp32p4]"
|
||||||
|
esp32async/asynctcp:
|
||||||
|
version: 3.4.91
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ lib_deps =
|
|||||||
WiFi ; wifi,web_server_base,ethernet (Arduino built-in)
|
WiFi ; wifi,web_server_base,ethernet (Arduino built-in)
|
||||||
Update ; ota,web_server_base (Arduino built-in)
|
Update ; ota,web_server_base (Arduino built-in)
|
||||||
${common:arduino.lib_deps}
|
${common:arduino.lib_deps}
|
||||||
ESP32Async/AsyncTCP@3.4.5 ; async_tcp
|
|
||||||
NetworkClientSecure ; http_request,nextion (Arduino built-in)
|
NetworkClientSecure ; http_request,nextion (Arduino built-in)
|
||||||
HTTPClient ; http_request,nextion (Arduino built-in)
|
HTTPClient ; http_request,nextion (Arduino built-in)
|
||||||
ESPmDNS ; mdns (Arduino built-in)
|
ESPmDNS ; mdns (Arduino built-in)
|
||||||
|
|||||||
Reference in New Issue
Block a user