feat: Polishing the frontend ota. Updated tdds and documentation
This commit is contained in:
@@ -121,16 +121,16 @@ The frontend calls the ESP32's REST API. The base URL depends on the environment
|
||||
|
||||
This is handled via Vite's `.env.development` and `.env.production` files. The value is baked in at compile time — zero runtime overhead.
|
||||
|
||||
## 9. OTA Considerations (Future)
|
||||
## 9. OTA & Versioning Implementation
|
||||
|
||||
When OTA updates are implemented, the frontend will be embedded into the firmware binary as a C header array:
|
||||
Instead of embedding the UI directly into the firmware binary as originally considered, we implemented a **Standalone Partition OTA** for maximum flexibility:
|
||||
|
||||
1. `npm run build:esp32` → `dist/index.html.gz` (~16kB)
|
||||
2. A script converts the gzipped file to a C `const uint8_t[]` array
|
||||
3. The array is compiled into the firmware binary
|
||||
4. OTA flashes one binary that includes both firmware and frontend
|
||||
1. **A/B Partitioning**: The frontend is staged to an inactive LittleFS slot (`www_0` or `www_1`).
|
||||
2. **Semantic Versioning**: `version.json` tracks `major.minor.revision`.
|
||||
3. **Auto-Increment**: A custom `node scripts/package.js` script automatically increments the revision and generates a versioned binary (e.g., `www_v0.1.6.bin`).
|
||||
4. **Resilient UX**: The Svelte app implements "Resilient Recovery Polling" — it enters a dedicated `isRecovering` state during reboot that ignores connection errors until the device is confirmed back online.
|
||||
|
||||
This avoids needing a separate SPIFFS partition for the frontend and ensures the UI always matches the firmware version.
|
||||
This decoupled approach allows for rapid frontend iteration without touching the 1M+ firmware binary.
|
||||
|
||||
## 10. Summary
|
||||
|
||||
@@ -183,8 +183,8 @@ Provider/frontend/
|
||||
|
||||
- System info display: chip model, free heap, uptime, firmware version, connection type
|
||||
- Reboot button with confirmation modal
|
||||
- Auto-refresh polling every 5 seconds
|
||||
- Four status states: loading, connected, offline, rebooting
|
||||
- **Resilient Auto-Reload**: Targeted polling during reboot that handles intermediate connection failures.
|
||||
- **OTA Dashboard**: Dedicated card showing version, active slot, and real-time partition statistics.
|
||||
- Dark theme with custom color tokens
|
||||
- Fully responsive layout
|
||||
|
||||
@@ -208,5 +208,4 @@ Provider/frontend/
|
||||
|
||||
### Known Issues
|
||||
|
||||
- **W: drive**: Vite requires `resolve.preserveSymlinks: true` in `vite.config.js` because `W:` is a `subst` drive mapped to `C:\Dev\...`. Without this, the build fails with `fileName` path resolution errors.
|
||||
- **ESP32 backend not yet implemented**: The frontend expects `GET /api/system/info` and `POST /api/system/reboot` endpoints. These need to be added to `main.cpp` using `esp_http_server`.
|
||||
- **ESP-IDF Header Ordering**: Some C++ linting errors persist regarding unused headers (e.g., `esp_log.h`) that are actually required for macros; these are suppressed or ignored to maintain compatibility with the unity build pattern.
|
||||
|
||||
Reference in New Issue
Block a user