Skip to content

Commit 2ca19ec

Browse files
committed
Move LibreTiny macros to .cpp
1 parent 6639a95 commit 2ca19ec

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/AsyncTCP.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ static unsigned long millis() {
2727

2828
#ifdef LIBRETINY
2929
#include <Arduino.h>
30+
// LibreTiny does not support IDF - disable code that expects it to be available
31+
#define ESP_IDF_VERSION_MAJOR (0)
32+
// xTaskCreatePinnedToCore is not available, force single-core operation
33+
#define CONFIG_FREERTOS_UNICORE 1
34+
// ESP watchdog is not available
35+
#undef CONFIG_ASYNC_TCP_USE_WDT
36+
#define CONFIG_ASYNC_TCP_USE_WDT 0
3037
#endif
3138

3239
extern "C" {
@@ -868,6 +875,7 @@ bool AsyncClient::connect(const IPAddress &ip, uint16_t port) {
868875
ip_addr_t addr;
869876
#if ESP_IDF_VERSION_MAJOR < 5
870877
#if LWIP_IPV4 && LWIP_IPV6
878+
// if both IPv4 and IPv6 are enabled, ip_addr_t has a union field and the address type
871879
addr.u_addr.ip4.addr = ip;
872880
addr.type = IPADDR_TYPE_V4;
873881
#else

src/AsyncTCP.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "AsyncTCPVersion.h"
88
#define ASYNCTCP_FORK_ESP32Async
99

10-
#ifdef LIBRETINY
11-
#define ESP_IDF_VERSION_MAJOR (0)
12-
#else
10+
#ifndef LIBRETINY
1311
#include <esp_idf_version.h>
1412
#endif
1513

@@ -37,7 +35,6 @@ extern "C" {
3735
#include <semphr.h>
3836
}
3937
#define CONFIG_ASYNC_TCP_RUNNING_CORE -1 // any available core
40-
#define CONFIG_FREERTOS_UNICORE 1
4138
#endif
4239

4340
// If core is not defined, then we are running in Arduino or PIO

0 commit comments

Comments
 (0)