Skip to content
This repository was archived by the owner on Jan 21, 2025. It is now read-only.

Commit 02e233f

Browse files
committed
Added CI for H2
1 parent f9d70ce commit 02e233f

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

examples/CaptivePortal/CaptivePortal.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class CaptiveRequestHandler : public AsyncWebHandler {
2929
response->print("<!DOCTYPE html><html><head><title>Captive Portal</title></head><body>");
3030
response->print("<p>This is out captive portal front page.</p>");
3131
response->printf("<p>You were trying to reach: http://%s%s</p>", request->host().c_str(), request->url().c_str());
32+
#ifndef CONFIG_IDF_TARGET_ESP32H2
3233
response->printf("<p>Try opening <a href='http://%s'>this link</a> instead</p>", WiFi.softAPIP().toString().c_str());
34+
#endif
3335
response->print("</body></html>");
3436
request->send(response);
3537
}
@@ -40,13 +42,16 @@ void setup() {
4042
Serial.println();
4143
Serial.println("Configuring access point...");
4244

45+
#ifndef CONFIG_IDF_TARGET_ESP32H2
4346
if (!WiFi.softAP("esp-captive")) {
4447
Serial.println("Soft AP creation failed.");
4548
while (1)
4649
;
4750
}
4851

4952
dnsServer.start(53, "*", WiFi.softAPIP());
53+
#endif
54+
5055
server.addHandler(new CaptiveRequestHandler()).setFilter(ON_AP_FILTER); // only when requested from AP
5156
// more handlers...
5257
server.begin();

examples/Filters/Filters.ino

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class CaptiveRequestHandler : public AsyncWebHandler {
3131
response->print("<!DOCTYPE html><html><head><title>Captive Portal</title></head><body>");
3232
response->print("<p>This is out captive portal front page.</p>");
3333
response->printf("<p>You were trying to reach: http://%s%s</p>", request->host().c_str(), request->url().c_str());
34+
#ifndef CONFIG_IDF_TARGET_ESP32H2
3435
response->printf("<p>Try opening <a href='http://%s'>this link</a> instead</p>", WiFi.softAPIP().toString().c_str());
36+
#endif
3537
response->print("</body></html>");
3638
request->send(response);
3739
}
@@ -46,15 +48,21 @@ void setup() {
4648
server
4749
.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
4850
Serial.println("Captive portal request...");
51+
#ifndef CONFIG_IDF_TARGET_ESP32H2
4952
Serial.println("WiFi.localIP(): " + WiFi.localIP().toString());
53+
#endif
5054
Serial.println("request->client()->localIP(): " + request->client()->localIP().toString());
5155
#if ESP_IDF_VERSION_MAJOR >= 5
56+
#ifndef CONFIG_IDF_TARGET_ESP32H2
5257
Serial.println("WiFi.type(): " + String((int)WiFi.localIP().type()));
58+
#endif
5359
Serial.println("request->client()->type(): " + String((int)request->client()->localIP().type()));
5460
#endif
61+
#ifndef CONFIG_IDF_TARGET_ESP32H2
5562
Serial.println(WiFi.localIP() == request->client()->localIP() ? "should be: ON_STA_FILTER" : "should be: ON_AP_FILTER");
5663
Serial.println(WiFi.localIP() == request->client()->localIP());
5764
Serial.println(WiFi.localIP().toString() == request->client()->localIP().toString());
65+
#endif
5866
request->send(200, "text/plain", "This is the captive portal");
5967
hit1 = true;
6068
})
@@ -63,15 +71,21 @@ void setup() {
6371
server
6472
.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
6573
Serial.println("Website request...");
74+
#ifndef CONFIG_IDF_TARGET_ESP32H2
6675
Serial.println("WiFi.localIP(): " + WiFi.localIP().toString());
76+
#endif
6777
Serial.println("request->client()->localIP(): " + request->client()->localIP().toString());
6878
#if ESP_IDF_VERSION_MAJOR >= 5
79+
#ifndef CONFIG_IDF_TARGET_ESP32H2
6980
Serial.println("WiFi.type(): " + String((int)WiFi.localIP().type()));
81+
#endif
7082
Serial.println("request->client()->type(): " + String((int)request->client()->localIP().type()));
7183
#endif
84+
#ifndef CONFIG_IDF_TARGET_ESP32H2
7285
Serial.println(WiFi.localIP() == request->client()->localIP() ? "should be: ON_STA_FILTER" : "should be: ON_AP_FILTER");
7386
Serial.println(WiFi.localIP() == request->client()->localIP());
7487
Serial.println(WiFi.localIP().toString() == request->client()->localIP().toString());
88+
#endif
7589
request->send(200, "text/plain", "This is the website");
7690
hit2 = true;
7791
})
@@ -92,12 +106,15 @@ void setup() {
92106
// dnsServer.stop();
93107
// WiFi.softAPdisconnect();
94108

109+
#ifndef CONFIG_IDF_TARGET_ESP32H2
95110
WiFi.persistent(false);
96111
WiFi.begin("IoT");
97112
while (WiFi.status() != WL_CONNECTED) {
98113
delay(500);
99114
}
100115
Serial.println("Connected to WiFi with IP address: " + WiFi.localIP().toString());
116+
#endif
117+
101118
server.begin();
102119

103120
// while (!hit2) {

examples/SimpleServer/SimpleServer.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void setup() {
3838

3939
Serial.begin(115200);
4040

41+
#ifndef CONFIG_IDF_TARGET_ESP32H2
4142
// WiFi.mode(WIFI_STA);
4243
// WiFi.begin("YOUR_SSID", "YOUR_PASSWORD");
4344
// if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -49,6 +50,7 @@ void setup() {
4950

5051
WiFi.mode(WIFI_AP);
5152
WiFi.softAP("esp-captive");
53+
#endif
5254

5355
server.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
5456
request->send(200, "text/plain", "Hello, world");

examples/StreamFiles/StreamFiles.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ void setup() {
2323

2424
LittleFS.begin();
2525

26+
#ifndef CONFIG_IDF_TARGET_ESP32H2
2627
WiFi.mode(WIFI_AP);
2728
WiFi.softAP("esp-captive");
29+
2830
dnsServer.start(53, "*", WiFi.softAPIP());
31+
#endif
2932

3033
File file1 = LittleFS.open("/header.html", "w");
3134
file1.print("<html><head><title>ESP Captive Portal</title><meta http-equiv=\"refresh\" content=\"1\"></head><body>");

platformio.ini

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ monitor_filters = esp32_exception_decoder, log2file
1515

1616
[platformio]
1717
lib_dir = .
18-
; src_dir = examples/CaptivePortal
19-
src_dir = examples/SimpleServer
18+
src_dir = examples/CaptivePortal
19+
; src_dir = examples/SimpleServer
2020
; src_dir = examples/StreamFiles
2121
; src_dir = examples/Filters
2222
; src_dir = examples/Draft
@@ -78,3 +78,10 @@ board = esp32-c6-devkitc-1
7878
lib_deps =
7979
bblanchon/ArduinoJson @ 7.1.0
8080
mathieucarbou/AsyncTCP @ 3.2.4
81+
82+
[env:pioarduino-h2]
83+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
84+
board = esp32-h2-devkitm-1
85+
lib_deps =
86+
bblanchon/ArduinoJson @ 7.1.0
87+
mathieucarbou/AsyncTCP @ 3.2.4

0 commit comments

Comments
 (0)