Skip to content

feat: esp-idf #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log

## 1.9

### 1.9.0

- Feat: allow code generator for esp-idf

## 1.8

### 1.8.1
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ I often make small to medium-sized microcontroller solutions that run on ESP32 o

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.

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

> Starting with version v1.9.0, code generator for esp-idf is available

> Starting with version v1.8.0, use the new and maintained ESPAsyncWebserver available at https://github.com/ESP32Async/ESPAsyncWebServer

Expand Down
10 changes: 10 additions & 0 deletions demo/esp32idf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

src/credentials.h
include/**/*.h
CMakeLists.txt
sdkconfig.idf*
10 changes: 10 additions & 0 deletions demo/esp32idf/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
9 changes: 9 additions & 0 deletions demo/esp32idf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Example platformio project

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.

It can be built on both web servers with the following command (if platformio is installed).

```bash
~/.platformio/penv/bin/pio run -d ./demo/esp32idf
```
1 change: 1 addition & 0 deletions demo/esp32idf/include/placeholder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generated header files
48 changes: 48 additions & 0 deletions demo/esp32idf/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[env]
platform = espressif32
board = lolin_s3_mini
framework = espidf



[env:idf]
build_flags =
-I include/_

[env:idf_E]
build_flags =
-I include/e

[env:idf_EC]
build_flags =
-I include/ec
-D SVELTEESP32_ENABLE_ETAG

[env:idf_ECG]
build_flags =
-I include/ecg
-D SVELTEESP32_ENABLE_ETAG

[env:idf_ECGC]
build_flags =
-I include/ecgc
-D SVELTEESP32_ENABLE_ETAG
-D SVELTEESP32_ENABLE_GZIP

[env:idf_EG]
build_flags =
-I include/eg

[env:idf_EGC]
build_flags =
-I include/egc
-D SVELTEESP32_ENABLE_GZIP

[env:idf_G]
build_flags =
-I include/g

[env:idf_GC]
build_flags =
-I include/gc
-D SVELTEESP32_ENABLE_GZIP
24 changes: 24 additions & 0 deletions demo/esp32idf/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <esp_http_server.h>
#include "svelteesp32espidf.h"

void start_http_server(void)
{
httpd_handle_t httpd;
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.max_uri_handlers = SVELTEESP32_COUNT + 99;

printf("Starting server on port: '%d'\n", config.server_port);

ESP_ERROR_CHECK(httpd_start(&httpd, &config));
initSvelteStaticFiles(httpd);
}

void app_main(void)
{
printf("Hello from ESP-IDF!\n");
start_http_server();
while (1)
{
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
Binary file modified demo/svelte/dist/favicon.png.gz
Binary file not shown.
Loading