Add LED web UI with AP, Wi-Fi client, mDNS and patterns
Brings the led_strip example into the cpp app, targeting the ESP32-C3: - Access point led-XXXXXX (open) plus a Wi-Fi client configured from the web Settings tab, with credentials stored in NVS and reconnect backoff - mDNS as led.local with an HTTP service on port 80 - HTTP server with an embedded web UI and a JSON API for patterns and Wi-Fi - Pattern runner for solid, rainbow, chase, breathe, blink, pulse, transition and circle on a 119-LED WS2812 strip (GPIO 10) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df43820acd
commit
89f996096c
20 files changed
+1539
-18
No files matched your search
@@ -53,10 +53,32 @@ led-driver/
|
||||
|
||||
## C++ app (ESP-IDF)
|
||||
|
||||
The `cpp` branch adds a basic ESP-IDF project for ESP32-S3 at the repo root (`CMakeLists.txt`, `main/`).
|
||||
The `cpp` branch is an ESP-IDF app for the ESP32-C3 at the repo root (`CMakeLists.txt`, `main/`, `web/`). It drives a 119-LED WS2812 strip on GPIO 10 (set in `main/patterns.cpp`).
|
||||
|
||||
### Web UI, access point and Wi-Fi client
|
||||
|
||||
The firmware runs three things at once:
|
||||
|
||||
- **Access point** `led-XXXXXX` (the last three bytes of the MAC), open, no password. Join it and browse to `http://192.168.4.1/`.
|
||||
- **Wi-Fi client**: set a network from the Settings tab (scan, pick, enter password). Credentials are saved to NVS, and the client reconnects with backoff after a drop.
|
||||
- **mDNS**: once on a network, the device answers as `http://led.local/`.
|
||||
|
||||
Patterns: solid, rainbow, chase, breathe, blink, pulse, transition and circle. The web UI is embedded in the firmware from `web/`.
|
||||
|
||||
JSON API (port 80):
|
||||
|
||||
| Method | Path | Purpose |
|
||||
|--------|------|---------|
|
||||
| GET | `/api/status` | Current pattern and parameters, AP name, client state and IP |
|
||||
| POST | `/api/pattern` | `{"mode","c1":[r,g,b],"c2":[r,g,b],"speed_ms","brightness"}` |
|
||||
| GET | `/api/wifi` | Saved client SSID and connection state |
|
||||
| POST | `/api/wifi` | `{"ssid","password"}`: save and connect |
|
||||
| GET | `/api/wifi/scan` | Visible networks |
|
||||
|
||||
Build and flash for the ESP32-C3:
|
||||
|
||||
```bash
|
||||
. ~/.espressif/v6.1/esp-idf/export.sh # or your ESP-IDF install's export.sh
|
||||
idf.py set-target esp32s3
|
||||
. ~/.espressif/v6.1/esp-idf/export.sh
|
||||
idf.py set-target esp32c3
|
||||
idf.py build flash monitor
|
||||
```
|
||||
Reference in new issue
Block a user