Skip to content

Commit b8df573

Browse files
committed
fix: complete platformio app with wifi connection
1 parent 2450c3c commit b8df573

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ dist
1212

1313
# dotenv environment variables file
1414
.env
15-
16-
demo/esp32/include/**/*.h

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
- The etag and gzip compiler option: For Etag and Gzip switches, values ​​true|false|compiler can be used. In the case of a compiler value, both variants can be found in the .h file and you can decide at compile time which one should be used.
1010

11-
- The created and version info: You can put the creation date and a version number in the .h file with the --create and --version options.
11+
- The created and version info: You can put the creation date and a version number in the .h file with the --created and --version options.
1212

13-
- 2x9 build and test system
13+
- 2x9 build and test system: We also run all possible parameter combinations (etag and gzip) for the Async and Psychic web servers.
1414

1515
- Separated demo env
1616

demo/esp32/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
.vscode/c_cpp_properties.json
44
.vscode/launch.json
55
.vscode/ipch
6+
7+
src/credentials.h
8+
include/**/*.h

demo/esp32/src/credentials.h.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef CREDENTIALS_H
2+
#define CREDENTIALS_H
3+
4+
char ssid[] = "myNetwork"; // your network SSID (name)
5+
char pass[] = "myPassword"; // your network password
6+
7+
#endif

demo/esp32/src/main.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifdef ASYNC
22
/* ESPAsyncWebServer example */
33

4+
#include "credentials.h"
5+
#include <WiFi.h>
46
#include <ESPAsyncWebServer.h>
57
#include "svelteesp32async.h"
68

@@ -19,6 +21,12 @@
1921
AsyncWebServer server(80);
2022
void setup()
2123
{
24+
WiFi.mode(WIFI_STA);
25+
WiFi.begin(ssid, pass);
26+
if (WiFi.waitForConnectResult() != WL_CONNECTED)
27+
while (true)
28+
;
29+
2230
initSvelteStaticFiles(&server);
2331
server.begin();
2432
}
@@ -27,6 +35,8 @@ void loop() {}
2735
#elif PSYCHIC
2836
/* PsychicHttp example */
2937

38+
#include "credentials.h"
39+
#include <WiFi.h>
3040
#include <PsychicHttp.h>
3141
#include "svelteesp32psychic.h"
3242

@@ -45,6 +55,12 @@ void loop() {}
4555
PsychicHttpServer server;
4656
void setup()
4757
{
58+
WiFi.mode(WIFI_STA);
59+
WiFi.begin(ssid, pass);
60+
if (WiFi.waitForConnectResult() != WL_CONNECTED)
61+
while (true)
62+
;
63+
4864
server.listen(80);
4965
initSvelteStaticFiles(&server);
5066
}

0 commit comments

Comments
 (0)