Skip to content

Commit 7c3d607

Browse files
authored
feat: esp-idf (#43)
* chore: deps * chore: demo deps * feat: espidf demo * feat: esp idf template * release: 1.9.0
1 parent d901141 commit 7c3d607

16 files changed

+554
-444
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change log
22

3+
## 1.9
4+
5+
### 1.9.0
6+
7+
- Feat: allow code generator for esp-idf
8+
39
## 1.8
410

511
### 1.8.1

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ I often make small to medium-sized microcontroller solutions that run on ESP32 o
1010

1111
In order to be able to easily update OTA, it is important - from the users' point of view - that the update file **consists of one file**. I can't use the SPIFFS/LittleFS solution for this. It is necessary that the WebUI files are included inline in the Arduino or PlatformIO c++ code.
1212

13-
This npm package provides a solution for **inserting any JS client application into the ESP web server** (PsychicHttp and also ESPAsyncWebServer (https://github.com/ESP32Async/ESPAsyncWebServer) available, PsychicHttp is the default). For this, JS, html, css, font, assets, etc. files must be converted to binary byte array. Npm mode is easy to use and easy to **integrate into your CI/CD pipeline**.
13+
This npm package provides a solution for **inserting any JS client application into the ESP web server** (PsychicHttp and also ESPAsyncWebServer (https://github.com/ESP32Async/ESPAsyncWebServer) and ESP-IDF available, PsychicHttp is the default). For this, JS, html, css, font, assets, etc. files must be converted to binary byte array. Npm mode is easy to use and easy to **integrate into your CI/CD pipeline**.
14+
15+
> Starting with version v1.9.0, code generator for esp-idf is available
1416
1517
> Starting with version v1.8.0, use the new and maintained ESPAsyncWebserver available at https://github.com/ESP32Async/ESPAsyncWebServer
1618

demo/esp32idf/.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch
6+
7+
src/credentials.h
8+
include/**/*.h
9+
CMakeLists.txt
10+
sdkconfig.idf*

demo/esp32idf/.vscode/extensions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"platformio.platformio-ide"
6+
],
7+
"unwantedRecommendations": [
8+
"ms-vscode.cpptools-extension-pack"
9+
]
10+
}

demo/esp32idf/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Example platformio project
2+
3+
This folder contains a buildable minimalistic project. An example shows how to use the header file in a platformio project. It also works as a native ESP-IDF project.
4+
5+
It can be built on both web servers with the following command (if platformio is installed).
6+
7+
```bash
8+
~/.platformio/penv/bin/pio run -d ./demo/esp32idf
9+
```

demo/esp32idf/include/placeholder.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Generated header files

demo/esp32idf/platformio.ini

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[env]
2+
platform = espressif32
3+
board = lolin_s3_mini
4+
framework = espidf
5+
6+
7+
8+
[env:idf]
9+
build_flags =
10+
-I include/_
11+
12+
[env:idf_E]
13+
build_flags =
14+
-I include/e
15+
16+
[env:idf_EC]
17+
build_flags =
18+
-I include/ec
19+
-D SVELTEESP32_ENABLE_ETAG
20+
21+
[env:idf_ECG]
22+
build_flags =
23+
-I include/ecg
24+
-D SVELTEESP32_ENABLE_ETAG
25+
26+
[env:idf_ECGC]
27+
build_flags =
28+
-I include/ecgc
29+
-D SVELTEESP32_ENABLE_ETAG
30+
-D SVELTEESP32_ENABLE_GZIP
31+
32+
[env:idf_EG]
33+
build_flags =
34+
-I include/eg
35+
36+
[env:idf_EGC]
37+
build_flags =
38+
-I include/egc
39+
-D SVELTEESP32_ENABLE_GZIP
40+
41+
[env:idf_G]
42+
build_flags =
43+
-I include/g
44+
45+
[env:idf_GC]
46+
build_flags =
47+
-I include/gc
48+
-D SVELTEESP32_ENABLE_GZIP

demo/esp32idf/src/main.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <esp_http_server.h>
2+
#include "svelteesp32espidf.h"
3+
4+
void start_http_server(void)
5+
{
6+
httpd_handle_t httpd;
7+
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
8+
config.max_uri_handlers = SVELTEESP32_COUNT + 99;
9+
10+
printf("Starting server on port: '%d'\n", config.server_port);
11+
12+
ESP_ERROR_CHECK(httpd_start(&httpd, &config));
13+
initSvelteStaticFiles(httpd);
14+
}
15+
16+
void app_main(void)
17+
{
18+
printf("Hello from ESP-IDF!\n");
19+
start_http_server();
20+
while (1)
21+
{
22+
vTaskDelay(1000 / portTICK_PERIOD_MS);
23+
}
24+
}

demo/svelte/dist/favicon.png.gz

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)