Fix Threshold and improve program and UI features
This commit is contained in:
66
README.md
66
README.md
@@ -315,7 +315,9 @@ Modes:
|
||||
| `cool` | Runs the pump when measured temperature is above the target |
|
||||
| `warm` | Runs the pump when measured temperature is below the target |
|
||||
|
||||
The target temperature is stored in Celsius and supports up to two decimals. The firmware compares the measured temperature and target temperature at two-decimal precision. In `cool` mode, the pump runs when the measured temperature is at least 0.25 C above the target. In `warm` mode, the pump runs when the measured temperature is at least 0.25 C below the target.
|
||||
The target temperature and threshold are stored in Celsius and support up to two decimals. The firmware compares the measured temperature, target temperature, and threshold at two-decimal precision. The threshold acts as the start offset only. In `cool` mode, the pump starts when the measured temperature is at least the threshold above the target and then stops only when the measured temperature reaches the target again. In `warm` mode, the pump starts when the measured temperature is at least the threshold below the target and then stops only when the measured temperature reaches the target again. The default threshold is 0.25 C.
|
||||
|
||||
The max runtime is stored in minutes and defaults to 5 minutes. It limits one continuous automatic pump run. If the pump runs for the configured max runtime without reaching the target temperature, the firmware switches the program mode to `off`, turns the pump off, persists the new mode, and emits a `program` SSE event with only the changed fields, such as `mode`, `pumpEnabled`, and `reason`, so the Program tile can update without overwriting settings the user is editing.
|
||||
|
||||
Read the current program:
|
||||
|
||||
@@ -331,10 +333,10 @@ POST /api/program
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{"mode":"cool","targetTemperatureC":22.75}
|
||||
{"mode":"cool","targetTemperatureC":22.75,"toleranceC":0.25,"maxRuntimeMinutes":5}
|
||||
```
|
||||
|
||||
The response includes `mode`, `targetTemperatureC`, `targetTemperatureF`, `toleranceC`, `pumpEnabled`, `sensorConnected`, and the latest `temperatureC`.
|
||||
The response includes `mode`, `targetTemperatureC`, `targetTemperatureF`, `toleranceC`, `maxRuntimeMinutes`, `pumpEnabled`, `sensorConnected`, and the latest `temperatureC`.
|
||||
|
||||
### Authentication
|
||||
|
||||
@@ -476,6 +478,57 @@ Content-Type: application/json
|
||||
|
||||
Use `"role":"PUBLIC"` to make a known API public.
|
||||
|
||||
### Project scripts
|
||||
|
||||
The `scripts/` directory contains small build and packaging helpers. They assume they are run from the project checkout and use the `seeed_xiao_esp32c3` PlatformIO environment by default.
|
||||
|
||||
| Script | Purpose |
|
||||
| --- | --- |
|
||||
| `scripts/platformio_targets.py` | Registers the custom PlatformIO target `uploadall`, shown in the PlatformIO UI as `Upload Firmware and Filesystem`. |
|
||||
| `scripts/create_update_package.py` | Combines an existing firmware image and LittleFS image into one `.tslpkg` OTA update package. |
|
||||
| `scripts/build_ota_package.py` | Builds LittleFS and firmware, then creates a timestamped `.tslpkg` file in `dist/`. |
|
||||
| `scripts/build_upload_device.py` | Builds LittleFS and firmware, then uploads both to a connected device. |
|
||||
|
||||
Create a timestamped OTA package in `dist/`:
|
||||
|
||||
```sh
|
||||
python scripts/build_ota_package.py
|
||||
```
|
||||
|
||||
Useful options:
|
||||
|
||||
```sh
|
||||
python scripts/build_ota_package.py -e seeed_xiao_esp32c3 -o dist
|
||||
python scripts/build_ota_package.py --pio C:\Users\<user>\.platformio\penv\Scripts\pio.exe
|
||||
```
|
||||
|
||||
Upload firmware and filesystem to a connected device:
|
||||
|
||||
```sh
|
||||
python scripts/build_upload_device.py --upload-port COM3
|
||||
```
|
||||
|
||||
Useful options:
|
||||
|
||||
```sh
|
||||
python scripts/build_upload_device.py -e seeed_xiao_esp32c3 -p COM3
|
||||
python scripts/build_upload_device.py --pio C:\Users\<user>\.platformio\penv\Scripts\pio.exe
|
||||
```
|
||||
|
||||
Create a combined package from already-built images:
|
||||
|
||||
```sh
|
||||
pio run
|
||||
pio run -t buildfs
|
||||
python scripts/create_update_package.py
|
||||
```
|
||||
|
||||
Useful options:
|
||||
|
||||
```sh
|
||||
python scripts/create_update_package.py --firmware .pio/build/seeed_xiao_esp32c3/firmware.bin --filesystem .pio/build/seeed_xiao_esp32c3/littlefs.bin --output .pio/build/seeed_xiao_esp32c3/update.tslpkg
|
||||
```
|
||||
|
||||
### Firmware and filesystem updates
|
||||
|
||||
Because the Admin UI is stored in LittleFS, OTA releases are distributed as one combined update package. The package contains both the LittleFS filesystem image and the firmware image, so UI and firmware changes cannot drift apart during an update.
|
||||
@@ -489,16 +542,13 @@ Because the Admin UI is stored in LittleFS, OTA releases are distributed as one
|
||||
Create the single OTA package:
|
||||
|
||||
```sh
|
||||
pio run
|
||||
pio run -t buildfs
|
||||
python scripts/create_update_package.py
|
||||
python scripts/build_ota_package.py
|
||||
```
|
||||
|
||||
For a direct USB flash during development:
|
||||
|
||||
```sh
|
||||
pio run -t upload
|
||||
pio run -t uploadfs
|
||||
python scripts/build_upload_device.py --upload-port COM3
|
||||
```
|
||||
|
||||
For OTA updates, host `update.tslpkg` on your update server. The Admin UI has one update package URL. The default is:
|
||||
|
||||
Reference in New Issue
Block a user