Skip to content

Commit

Permalink
fix: complete platformio app with wifi connection
Browse files Browse the repository at this point in the history
  • Loading branch information
BCsabaEngine committed Aug 19, 2024
1 parent 2450c3c commit b8df573
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ dist

# dotenv environment variables file
.env

demo/esp32/include/**/*.h
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

- 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.

- 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.
- 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.

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

- Separated demo env

Expand Down
3 changes: 3 additions & 0 deletions demo/esp32/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

src/credentials.h
include/**/*.h
7 changes: 7 additions & 0 deletions demo/esp32/src/credentials.h.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef CREDENTIALS_H
#define CREDENTIALS_H

char ssid[] = "myNetwork"; // your network SSID (name)
char pass[] = "myPassword"; // your network password

#endif
16 changes: 16 additions & 0 deletions demo/esp32/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifdef ASYNC
/* ESPAsyncWebServer example */

#include "credentials.h"
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include "svelteesp32async.h"

Expand All @@ -19,6 +21,12 @@
AsyncWebServer server(80);
void setup()
{
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
if (WiFi.waitForConnectResult() != WL_CONNECTED)
while (true)
;

initSvelteStaticFiles(&server);
server.begin();
}
Expand All @@ -27,6 +35,8 @@ void loop() {}
#elif PSYCHIC
/* PsychicHttp example */

#include "credentials.h"
#include <WiFi.h>
#include <PsychicHttp.h>
#include "svelteesp32psychic.h"

Expand All @@ -45,6 +55,12 @@ void loop() {}
PsychicHttpServer server;
void setup()
{
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
if (WiFi.waitForConnectResult() != WL_CONNECTED)
while (true)
;

server.listen(80);
initSvelteStaticFiles(&server);
}
Expand Down

0 comments on commit b8df573

Please sign in to comment.