6
6
//
7
7
8
8
#include < DNSServer.h>
9
- #ifdef ESP32
9
+ #if defined( ESP32) || defined(LIBRETINY)
10
10
#include < AsyncTCP.h>
11
11
#include < WiFi.h>
12
12
#elif defined(ESP8266)
@@ -32,7 +32,7 @@ public:
32
32
response->print (" <!DOCTYPE html><html><head><title>Captive Portal</title></head><body>" );
33
33
response->print (" <p>This is out captive portal front page.</p>" );
34
34
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
36
36
response->printf (" <p>Try opening <a href='http://%s'>this link</a> instead</p>" , WiFi.softAPIP ().toString ().c_str ());
37
37
#endif
38
38
response->print (" </body></html>" );
@@ -51,17 +51,17 @@ void setup() {
51
51
" /" , HTTP_GET,
52
52
[](AsyncWebServerRequest *request) {
53
53
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
55
55
Serial.println (" WiFi.localIP(): " + WiFi.localIP ().toString ());
56
56
#endif
57
57
Serial.println (" request->client()->localIP(): " + request->client ()->localIP ().toString ());
58
58
#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
60
60
Serial.println (" WiFi.type(): " + String ((int )WiFi.localIP ().type ()));
61
61
#endif
62
62
Serial.println (" request->client()->type(): " + String ((int )request->client ()->localIP ().type ()));
63
63
#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
65
65
Serial.println (WiFi.localIP () == request->client ()->localIP () ? " should be: ON_STA_FILTER" : " should be: ON_AP_FILTER" );
66
66
Serial.println (WiFi.localIP () == request->client ()->localIP ());
67
67
Serial.println (WiFi.localIP ().toString () == request->client ()->localIP ().toString ());
@@ -77,17 +77,17 @@ void setup() {
77
77
" /" , HTTP_GET,
78
78
[](AsyncWebServerRequest *request) {
79
79
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
81
81
Serial.println (" WiFi.localIP(): " + WiFi.localIP ().toString ());
82
82
#endif
83
83
Serial.println (" request->client()->localIP(): " + request->client ()->localIP ().toString ());
84
84
#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
86
86
Serial.println (" WiFi.type(): " + String ((int )WiFi.localIP ().type ()));
87
87
#endif
88
88
Serial.println (" request->client()->type(): " + String ((int )request->client ()->localIP ().type ()));
89
89
#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
91
91
Serial.println (WiFi.localIP () == request->client ()->localIP () ? " should be: ON_STA_FILTER" : " should be: ON_AP_FILTER" );
92
92
Serial.println (WiFi.localIP () == request->client ()->localIP ());
93
93
Serial.println (WiFi.localIP ().toString () == request->client ()->localIP ().toString ());
@@ -113,7 +113,7 @@ void setup() {
113
113
// dnsServer.stop();
114
114
// WiFi.softAPdisconnect();
115
115
116
- #if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
116
+ #if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED || LT_ARD_HAS_WIFI
117
117
WiFi.persistent (false );
118
118
WiFi.begin (" IoT" );
119
119
while (WiFi.status () != WL_CONNECTED) {
0 commit comments