Skip to content

Commit dd934b8

Browse files
committed
Use WiFi related code on LibreTiny if supported
1 parent 01b0658 commit dd934b8

File tree

40 files changed

+86
-86
lines changed

40 files changed

+86
-86
lines changed

examples/AsyncResponseStream/AsyncResponseStream.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright 2016-2025 Hristo Gochkov, Mathieu Carbou, Emil Muratov
33

44
#include <DNSServer.h>
5-
#ifdef ESP32
5+
#if defined(ESP32) || defined(LIBRETINY)
66
#include <AsyncTCP.h>
77
#include <WiFi.h>
88
#elif defined(ESP8266)
@@ -20,7 +20,7 @@ static AsyncWebServer server(80);
2020
void setup() {
2121
Serial.begin(115200);
2222

23-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
23+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
2424
WiFi.mode(WIFI_AP);
2525
WiFi.softAP("esp-captive");
2626
#endif

examples/AsyncTunnel/AsyncTunnel.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -70,7 +70,7 @@ static const size_t htmlContentLength = strlen_P(htmlContent);
7070
void setup() {
7171
Serial.begin(115200);
7272

73-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
73+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
7474
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
7575
while (WiFi.status() != WL_CONNECTED) {
7676
delay(500);

examples/Auth/Auth.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -52,7 +52,7 @@ static AsyncAuthorizationMiddleware authz([](AsyncWebServerRequest *request) {
5252
void setup() {
5353
Serial.begin(115200);
5454

55-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
55+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
5656
WiFi.mode(WIFI_AP);
5757
WiFi.softAP("esp-captive");
5858
#endif

examples/CORS/CORS.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -25,7 +25,7 @@ static AsyncCorsMiddleware cors;
2525
void setup() {
2626
Serial.begin(115200);
2727

28-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
28+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
2929
WiFi.mode(WIFI_AP);
3030
WiFi.softAP("esp-captive");
3131
#endif

examples/CaptivePortal/CaptivePortal.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright 2016-2025 Hristo Gochkov, Mathieu Carbou, Emil Muratov
33

44
#include <DNSServer.h>
5-
#ifdef ESP32
5+
#if defined(ESP32) || defined(LIBRETINY)
66
#include <AsyncTCP.h>
77
#include <WiFi.h>
88
#elif defined(ESP8266)
@@ -28,7 +28,7 @@ public:
2828
response->print("<!DOCTYPE html><html><head><title>Captive Portal</title></head><body>");
2929
response->print("<p>This is our captive portal front page.</p>");
3030
response->printf("<p>You were trying to reach: http://%s%s</p>", request->host().c_str(), request->url().c_str());
31-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
31+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
3232
response->printf("<p>Try opening <a href='http://%s'>this link</a> instead</p>", WiFi.softAPIP().toString().c_str());
3333
#endif
3434
response->print("</body></html>");
@@ -41,7 +41,7 @@ void setup() {
4141
Serial.println();
4242
Serial.println("Configuring access point...");
4343

44-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
44+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
4545
if (!WiFi.softAP("esp-captive")) {
4646
Serial.println("Soft AP creation failed.");
4747
while (1);

examples/CatchAllHandler/CatchAllHandler.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -86,7 +86,7 @@ static const size_t htmlContentLength = strlen_P(htmlContent);
8686
void setup() {
8787
Serial.begin(115200);
8888

89-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
89+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
9090
WiFi.mode(WIFI_AP);
9191
WiFi.softAP("esp-captive");
9292
#endif

examples/ChunkResponse/ChunkResponse.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -86,7 +86,7 @@ static const size_t htmlContentLength = strlen_P(htmlContent);
8686
void setup() {
8787
Serial.begin(115200);
8888

89-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
89+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
9090
WiFi.mode(WIFI_AP);
9191
WiFi.softAP("esp-captive");
9292
#endif

examples/ChunkRetryResponse/ChunkRetryResponse.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -96,7 +96,7 @@ static int key = -1;
9696
void setup() {
9797
Serial.begin(115200);
9898

99-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
99+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
100100
WiFi.mode(WIFI_AP);
101101
WiFi.softAP("esp-captive");
102102
#endif

examples/EndBegin/EndBegin.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <Arduino.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -24,7 +24,7 @@ static AsyncWebServer server(80);
2424
void setup() {
2525
Serial.begin(115200);
2626

27-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
27+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
2828
WiFi.mode(WIFI_AP);
2929
WiFi.softAP("esp-captive");
3030
#endif

examples/Filters/Filters.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#include <DNSServer.h>
9-
#ifdef ESP32
9+
#if defined(ESP32) || defined(LIBRETINY)
1010
#include <AsyncTCP.h>
1111
#include <WiFi.h>
1212
#elif defined(ESP8266)
@@ -32,7 +32,7 @@ public:
3232
response->print("<!DOCTYPE html><html><head><title>Captive Portal</title></head><body>");
3333
response->print("<p>This is out captive portal front page.</p>");
3434
response->printf("<p>You were trying to reach: http://%s%s</p>", request->host().c_str(), request->url().c_str());
35-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
35+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
3636
response->printf("<p>Try opening <a href='http://%s'>this link</a> instead</p>", WiFi.softAPIP().toString().c_str());
3737
#endif
3838
response->print("</body></html>");
@@ -51,17 +51,17 @@ void setup() {
5151
"/", HTTP_GET,
5252
[](AsyncWebServerRequest *request) {
5353
Serial.println("Captive portal request...");
54-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
54+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
5555
Serial.println("WiFi.localIP(): " + WiFi.localIP().toString());
5656
#endif
5757
Serial.println("request->client()->localIP(): " + request->client()->localIP().toString());
5858
#if ESP_IDF_VERSION_MAJOR >= 5
59-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
59+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
6060
Serial.println("WiFi.type(): " + String((int)WiFi.localIP().type()));
6161
#endif
6262
Serial.println("request->client()->type(): " + String((int)request->client()->localIP().type()));
6363
#endif
64-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
64+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
6565
Serial.println(WiFi.localIP() == request->client()->localIP() ? "should be: ON_STA_FILTER" : "should be: ON_AP_FILTER");
6666
Serial.println(WiFi.localIP() == request->client()->localIP());
6767
Serial.println(WiFi.localIP().toString() == request->client()->localIP().toString());
@@ -77,17 +77,17 @@ void setup() {
7777
"/", HTTP_GET,
7878
[](AsyncWebServerRequest *request) {
7979
Serial.println("Website request...");
80-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
80+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
8181
Serial.println("WiFi.localIP(): " + WiFi.localIP().toString());
8282
#endif
8383
Serial.println("request->client()->localIP(): " + request->client()->localIP().toString());
8484
#if ESP_IDF_VERSION_MAJOR >= 5
85-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
85+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
8686
Serial.println("WiFi.type(): " + String((int)WiFi.localIP().type()));
8787
#endif
8888
Serial.println("request->client()->type(): " + String((int)request->client()->localIP().type()));
8989
#endif
90-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
90+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
9191
Serial.println(WiFi.localIP() == request->client()->localIP() ? "should be: ON_STA_FILTER" : "should be: ON_AP_FILTER");
9292
Serial.println(WiFi.localIP() == request->client()->localIP());
9393
Serial.println(WiFi.localIP().toString() == request->client()->localIP().toString());
@@ -113,7 +113,7 @@ void setup() {
113113
// dnsServer.stop();
114114
// WiFi.softAPdisconnect();
115115

116-
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
116+
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
117117
WiFi.persistent(false);
118118
WiFi.begin("IoT");
119119
while (WiFi.status() != WL_CONNECTED) {

0 commit comments

Comments
 (0)