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:
jimmyandClaude Haiku 5.5 committed 2026-11-11 00:02:49 +13:00
1 parent df43820acd
commit 89f996096c
20 files changed
+1539 -18

No files matched your search

+23 -11
View File
@@ -1,18 +1,30 @@
#include <cstdio>
/*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"
static const char *TAG = "led_driver";
#include "net.h"
#include "patterns.h"
#include "web.h"
static const char *TAG = "example";
extern "C" void app_main(void)
{
ESP_LOGI(TAG, "LED driver (C++) starting");
int tick = 0;
while (true) {
ESP_LOGI(TAG, "alive: %d", tick++);
vTaskDelay(pdMS_TO_TICKS(1000));
// NVS holds the saved Wi-Fi client credentials
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
patterns_start();
ESP_ERROR_CHECK(net_start());
ESP_ERROR_CHECK(web_start());
char ssid[16];
net_ap_ssid(ssid, sizeof(ssid));
ESP_LOGI(TAG, "Ready: join Wi-Fi %s and open http://192.168.4.1/, or http://led.local/ on your network", ssid);
}