docs: Finalize v0.3, add OTA section to USAGE.md

This commit is contained in:
user
2026-02-04 16:26:49 +01:00
parent efc3fec25f
commit 2f90a099b7
3 changed files with 102 additions and 16 deletions

View File

@@ -163,6 +163,86 @@ The router firmware uses only LLTF for broader router compatibility. The ESP-NOW
| `CONFIG_FORCE_GAIN` | `0` | Force AGC/FFT gain to baseline (disabled) |
| `CONFIG_GAIN_CONTROL` | `1` (auto) | Enable gain compensation (ESP32-S3, C3, C5, C6, C61) |
## Remote Management
### Commands (esp-cmd)
Send commands to individual devices over UDP port 5501:
```bash
esp-cmd <host> STATUS # Uptime, heap, RSSI, tx_power, rate, version
esp-cmd <host> IDENTIFY # LED solid 5s
esp-cmd <host> RATE <10-100> # Set ping rate (NVS saved)
esp-cmd <host> POWER <2-20> # Set TX power dBm (NVS saved)
esp-cmd <host> OTA <url> # Trigger OTA update (prefer esp-ota)
esp-cmd <host> REBOOT # Restart device
```
### Fleet Management (esp-fleet)
Send commands to all sensors in parallel:
```bash
esp-fleet status # Query all devices
esp-fleet identify # Blink all LEDs
esp-fleet rate 50 # Set rate on all
esp-fleet reboot # Reboot all
esp-fleet ota # OTA update all (sequential)
esp-fleet ota /path/to/fw # OTA with custom firmware
```
## OTA Updates
### Overview
Firmware updates are delivered over WiFi using ESP-IDF's `esp_https_ota` with a dual OTA partition layout. The device downloads a new binary from an HTTP server on the Pi, writes it to the inactive OTA slot, and reboots.
### Partition Layout
| Partition | Offset | Size | Purpose |
|-----------|--------|------|---------|
| nvs | 0x9000 | 16 KB | NVS config storage |
| otadata | 0xd000 | 8 KB | OTA boot selection |
| phy_init | 0xf000 | 4 KB | PHY calibration |
| ota_0 | 0x10000 | 1920 KB | App slot A |
| ota_1 | 0x1F0000 | 1920 KB | App slot B |
### Using esp-ota
The `esp-ota` tool handles the full OTA workflow:
```bash
esp-ota amber-maple.local # Default build path
esp-ota amber-maple.local -f custom.bin # Custom firmware
esp-ota amber-maple.local --no-wait # Don't verify reboot
```
**What it does:**
1. Verifies the device is alive (`STATUS`)
2. Starts a temporary HTTP server on port 8070
3. Sends `OTA http://<pi-ip>:8070/<firmware>.bin` to the device
4. Waits for the device to download, flash, reboot
5. Verifies the device responds with the new version
### Rollback
The bootloader supports automatic rollback on failed updates:
1. New firmware is written to the inactive OTA slot
2. Device reboots into the new firmware in `PENDING_VERIFY` state
3. If the firmware boots successfully (WiFi connects, mDNS starts, command listener ready), it marks itself as valid
4. If the firmware crashes or hangs, the 30s watchdog triggers a reboot and the bootloader rolls back to the previous slot
### First-Time Setup
The initial flash **must be done via USB** because switching from a single-app to a dual-OTA partition table requires erasing the entire flash. After the first USB flash, all subsequent updates can be done via OTA.
```bash
idf.py -p /dev/ttyUSB0 flash # First time: USB required
esp-ota amber-maple.local # All subsequent updates: OTA
```
## Receiving CSI Data on the Pi
Listen on UDP port 5500: