Skip to content

Commit c90a429

Browse files
authored
Several small changes and improvements (#10)
* Added core temp * added mDNS service and recovery mode * Final touch recovery mode incl. docs * Updated to Svelte 4 * Revert back to Svelte 3, CHANGELOG and push notifications * Fixed drawer issue introduced with DaisyUI 3.1.6 * Added telemetry via SSE for RSSI * FT_PROJECT feature flag removed * fimware version in factory_settings.ini and SystemStatus API * Deep Sleep Service API * Added battery indicator & service * Restructured OTA * Improvements System Status * WIP github update * Github Release OTA * Update documentation for github updates * Refactor WebSocket Server Code * Error messages for SSE and WS * Mark 53.33 degC als invalid * Generate SSL Root CA Store * build script for ssl certificate store * different ssl build config * Version updates * default env S3 * Update CHANGELOG.md * WebSocketClient Trials * WebSocketTrials * Learnings from other projects * Fixes for platformio issue * fixes for Arduino 6.4.0 * updated docs * hard fork ESPAsyncWebserver + System Metrics * Update docs
1 parent bca085c commit c90a429

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+9961
-540
lines changed

CHANGELOG.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.2.2]
6+
7+
### Added
8+
9+
- Status reports reset-reason & uptime.
10+
- AnalyticsService to draw graphs about heap usage and other time dependent values
11+
- Added ping to WebSocket Server
12+
- Use telemetry store with RSSI messages to gauge health of connection. Automatic reconnect for SSE and WS.
13+
- Added user supplied features to FeatureService
14+
- Compiler flag to let it serve the config JSONs for debug purposes
15+
- Hard fork of ESPAsyncWebserver as it is unmaintained to fix bugs and add features
16+
17+
### Changed
18+
19+
- Changed JSON format for websocket server and removed "payload" property. JSON is the same as for MQTT or HTTP now.
20+
- Changed features.ini to default `FT_SLEEP=0`
21+
- Updated dependencies to latest version.
22+
523
## [0.2.1] - 2023-09-11
624

725
### Fixed
@@ -46,10 +64,6 @@ All notable changes to this project will be documented in this file.
4664

4765
- `FT_PROJECT` feature flag removed.
4866

49-
### Fixed
50-
51-
### Security
52-
5367
## [0.1.0] - 2023-05-18
5468

5569
This is the initial release of ESP32-sveltekit. With this it is feature complete to [rjwats/esp8266-react](https://github.com/rjwats/esp8266-react), where it forked from.

docs/buildprocess.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Customize the settings as you see fit. A value of 0 will disable the specified f
5050
| FT_SLEEP | Controls whether the deep sleep feature is enabled. Disable this if your device is not battery operated or you don't need to place it in deep sleep to save energy. |
5151
| FT_BATTERY | Controls whether the battery state of charge shall be reported to the clients. Disable this if your device is not battery operated. |
5252

53+
In addition custom features might be added or removed at runtime. See [Custom Features](statefulservice.md#custom-features) on how to use this in your application.
54+
5355
## Factory Settings
5456

5557
The framework has built-in factory settings which act as default values for the various configurable services where settings are not saved on the file system. These settings can be overridden using the build flags defined in [factory_settings.ini](https://github.com/theelims/ESP32-sveltekit/blob/main/factory_settings.ini).
@@ -127,6 +129,16 @@ build_flags =
127129

128130
It accepts values from 1 (Verbose) to 5 (Errors) for different information depths to be logged on the serial terminal.
129131

132+
### Serve Config Files
133+
134+
By enabling this build flag the ESP32 will serve all config files stored on the LittleFS flash partition under `http:\\[IP]\config\[filename].json`. This can be helpful to troubleshoot problems. However, it is strongly advised to disable this for production builds.
135+
136+
```ini
137+
build_flags =
138+
...
139+
-D SERVE_CONFIG_FILES
140+
```
141+
130142
## SSL Root Certificate Store
131143

132144
Some features like firmware download require a SSL connection. For that the SSL Root CA certificate must be known to the ESP32. The build system contains a python script derived from Espressif ESP-IDF building a certificate store containing one or more certificates. In order to create the store you must uncomment the three lines below in `platformio.ini`.

docs/gettingstarted.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pip install mkdocs-material
5858
```ini
5959
[platformio]
6060
...
61-
default_envs = adafruit_feather_esp32_v2
61+
default_envs = esp32-s3-devkitc-1
6262
...
6363

6464
[env:adafruit_feather_esp32_v2]
@@ -76,6 +76,10 @@ board_build.mcu = esp32s3
7676

7777
If your board is not listed in the platformio.ini you may look in the [official board list](https://docs.platformio.org/en/latest/boards/index.html#espressif-32) for supported boards and add their information accordingly. Either delete the obsolete `[env:...]` sections, or change your board as `default_envs = ...`.
7878

79+
!!! info "Default setup is for an ESP32-S3-DevKitC/M board"
80+
81+
The projects platformio.ini defaults for an ESP32-S3-DevKitC/M board by Espressif connected to the UART USB port. If you use an other board and the projects shows undesired a behavior it is likely that some parts do not match with pin definitions.
82+
7983
### Build & Upload Process
8084

8185
After you've changed [platformio.ini](https://github.com/theelims/ESP32-sveltekit/blob/main/platformio.ini) to suit your board you can upload the sample code to your board. This will download all ESP32 libraries and execute `node install` to install all node packages as well. Select your board's environment under the PlatformIO tab and hit `Upload and Monitor`.

docs/statefulservice.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ void setup() {
3131
}
3232
```
3333

34-
Finally the loop calls the framework's loop function to service the frameworks features.
35-
36-
```cpp
37-
void loop() {
38-
// run the framework's loop function
39-
esp32sveltekit.loop();
40-
}
41-
```
42-
4334
## Stateful Service
4435

4536
The framework promotes a modular design and exposes features you may re-use to speed up the development of your project. Where possible it is recommended that you use the features the frameworks supplies. These are documented in this section and a comprehensive example is provided by the demo project.
@@ -426,6 +417,14 @@ esp32sveltekit.getBatteryService()->updateSOC(float stateOfCharge); // update st
426417
esp32sveltekit.getBatteryService()->setCharging(boolean isCharging); // notify the client that the device is charging
427418
```
428419
420+
### Custom Features
421+
422+
You may use the compile time feature service also to enable or disable custom features at runtime and thus control the frontend. A custom feature can only be added during initializing the ESP32 and ESP32-SvelteKit. A feature can't be updated on runtime once it is set once.
423+
424+
```cpp
425+
esp32sveltekit.getFeatureService()->addFeature("custom_feature", true); // or false to disable it
426+
```
427+
429428
## OTA Firmware Updates
430429

431430
ESP32-SvelteKit offers three different ways to roll out firmware updates to field devices. Except for ArduinoOTA all other OTA possibilities cannot update the file system. If the frontend should be updated as well it is necessary to serve it from PROGMEM by activating `-D PROGMEM_WWW`.

docs/stores.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,26 @@ It exposes the following properties you can subscribe to:
4141
| `$telemetry.download_ota.status` | `String` | Status of OTA |
4242
| `$telemetry.download_ota.progress` | `Number` | Progress of OTA |
4343
| `$telemetry.download_ota.error` | `String` | Error Message of OTA |
44+
45+
## Analytics
46+
47+
The analytics store holds a log of heap and other debug information via Server-Sent Events. The corresponding `eventListener` functions are located in `+layout.svelte`.
48+
49+
```ts
50+
import { analytics } from "$lib/stores/analytics";
51+
```
52+
53+
It exposes an array of the following properties you can subscribe to:
54+
55+
| Property | Type | Description |
56+
| --------------------------- | -------- | ---------------------------------------------- |
57+
| `$analytics.uptime` | `Number` | Uptime of the chip in seconds since last reset |
58+
| `$analytics.free_heap` | `Number` | Current free heap |
59+
| `$analytics.min_free_heap` | `Number` | Minimum free heap that has been |
60+
| `$analytics.max_alloc_heap` | `Number` | Biggest continues free chunk of heap |
61+
| `$analytics.fs_used` | `Number` | Bytes used on the file system |
62+
| `$analytics.fs_total` | `Number` | Total bytes of the file system |
63+
| `$analytics.core_temp` | `Number` | Core temperature (on some chips) |
64+
65+
By default there is one data point every 2 seconds.
66+

factory_settings.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[factory_settings]
88
build_flags =
99
; Global Settings
10-
-D FIRMWARE_VERSION=\"0.2.1\"
10+
-D FIRMWARE_VERSION=\"0.2.2\"
1111

1212
; WiFi settings
1313
-D FACTORY_WIFI_SSID=\"\"

features.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ build_flags =
66
-D FT_OTA=0 ; Not recommended, will be deprectiated in an upcomming release
77
-D FT_UPLOAD_FIRMWARE=1
88
-D FT_DOWNLOAD_FIRMWARE=1 ; requires FT_NTP=1
9-
-D FT_SLEEP=1
10-
-D FT_BATTERY=1
11-
9+
-D FT_SLEEP=0
10+
-D FT_BATTERY=0
11+
-D FT_ANALYTICS=1

0 commit comments

Comments
 (0)