refactor: move the v2 controller to the repository root

The ESP-IDF project, docs, tools, tests and web UI move from v2/ to the
root, and the Makefile, README, build scripts and test runner drop the
v2/ prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-02 23:44:58 +13:00
1 parent 71bd320661
commit 1c222771a5
66 files changed
+30 -31

No files matched your search

+5
View File
@@ -33,3 +33,8 @@ settings.json
*.sqlite *.sqlite
.pytest_cache/ .pytest_cache/
.ropeproject/ .ropeproject/
build/
sdkconfig
sdkconfig.old
managed_components/
www_dist/
+1 -1
View File
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(led_controller_v2) project(led_controller)
+12 -13
View File
@@ -1,4 +1,4 @@
# Build, flash and monitor the v2 ESP32-S3 controller (ESP-IDF in Docker). # Build, flash and monitor the ESP32-S3 controller (ESP-IDF in Docker).
# #
# make list the targets # make list the targets
# make build minify the web UI, then build the firmware # make build minify the web UI, then build the firmware
@@ -11,9 +11,8 @@
PORT ?= /dev/ttyACM0 PORT ?= /dev/ttyACM0
IDF_IMAGE ?= espressif/idf:v5.5.5 IDF_IMAGE ?= espressif/idf:v5.5.5
SECS ?= 10 SECS ?= 10
V2 := v2
DOCKER_RUN = docker run --rm -v "$(CURDIR)/$(V2)":/project -w /project DOCKER_RUN = docker run --rm -v "$(CURDIR)":/project -w /project
DEVICE = --device=$(PORT) DEVICE = --device=$(PORT)
# Interactive terminal only when there is one (monitor needs it, CI does not have it) # Interactive terminal only when there is one (monitor needs it, CI does not have it)
TTY := $(shell [ -t 0 ] && echo -it) TTY := $(shell [ -t 0 ] && echo -it)
@@ -26,7 +25,7 @@ FIX_OWNER = chown -R $(OWNER) /project
.PHONY: help web build flash ota monitor flash-monitor log size menuconfig clean fullclean erase test test-driver test-envelope .PHONY: help web build flash ota monitor flash-monitor log size menuconfig clean fullclean erase test test-driver test-envelope
help: help:
@echo "v2 controller (ESP32-S3):" @echo "LED controller (ESP32-S3):"
@echo " make build minify + gzip the web UI, then build the firmware" @echo " make build minify + gzip the web UI, then build the firmware"
@echo " make flash flash firmware and web UI to PORT ($(PORT))" @echo " make flash flash firmware and web UI to PORT ($(PORT))"
@echo " make ota HOST=ip build, then upload the firmware (web UI included) over Ethernet (no USB)" @echo " make ota HOST=ip build, then upload the firmware (web UI included) over Ethernet (no USB)"
@@ -44,7 +43,7 @@ help:
# --- web UI --------------------------------------------------------------- # --- web UI ---------------------------------------------------------------
web: web:
cd $(V2) && tools/build_web.sh tools/build_web.sh
# --- firmware ------------------------------------------------------------- # --- firmware -------------------------------------------------------------
build: web build: web
@@ -55,7 +54,7 @@ flash: build
ota: build ota: build
@test -n "$(HOST)" || { echo "usage: make ota HOST=<controller ip>"; exit 1; } @test -n "$(HOST)" || { echo "usage: make ota HOST=<controller ip>"; exit 1; }
python3 $(V2)/tools/ota.py $(HOST) python3 tools/ota.py $(HOST)
monitor: monitor:
$(DOCKER_RUN) $(TTY) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) monitor $(DOCKER_RUN) $(TTY) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) monitor
@@ -64,7 +63,7 @@ flash-monitor: flash monitor
# Non-interactive: reset the board and print what it says for SECS seconds # Non-interactive: reset the board and print what it says for SECS seconds
log: log:
python3 $(V2)/tools/serial_log.py $(PORT) $(SECS) python3 tools/serial_log.py $(PORT) $(SECS)
size: size:
$(DOCKER_RUN) $(IDF_IMAGE) bash -c 'idf.py size; rc=$$?; $(FIX_OWNER); exit $$rc' $(DOCKER_RUN) $(IDF_IMAGE) bash -c 'idf.py size; rc=$$?; $(FIX_OWNER); exit $$rc'
@@ -76,23 +75,23 @@ erase:
$(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) erase-flash $(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) erase-flash
clean: clean:
rm -rf $(V2)/build rm -rf build
fullclean: clean fullclean: clean
rm -rf $(V2)/sdkconfig $(V2)/sdkconfig.old $(V2)/www_dist rm -rf sdkconfig sdkconfig.old www_dist
# --- tests ---------------------------------------------------------------- # --- tests ----------------------------------------------------------------
test: test-driver test-envelope test: test-driver test-envelope
# Host-side unit tests for the driver's link layer and beat sync (pure Python) # Host-side unit tests for the driver's link layer and beat sync (pure Python)
test-driver: test-driver:
python3 $(V2)/tools/run_driver_tests.py python3 tools/run_driver_tests.py
# The C envelope packer must produce the same bytes as v2/test/binary_envelope.py # The C envelope packer must produce the same bytes as test/binary_envelope.py
test-envelope: test-envelope:
@tmp=$$(mktemp -d); \ @tmp=$$(mktemp -d); \
(cd $(V2)/test && python3 env_check.py) > $$tmp/py.txt; \ (cd test && python3 env_check.py) > $$tmp/py.txt; \
docker run --rm -v "$(CURDIR)/$(V2)":/project -w /project/test $(IDF_IMAGE) bash -c \ docker run --rm -v "$(CURDIR)":/project -w /project/test $(IDF_IMAGE) bash -c \
'gcc -Wall -I/opt/esp/idf/components/json/cJSON env_host.c ../main/envelope.c /opt/esp/idf/components/json/cJSON/cJSON.c -o /tmp/t -lm && /tmp/t' 2>&1 | tail -2 > $$tmp/c.txt; \ 'gcc -Wall -I/opt/esp/idf/components/json/cJSON env_host.c ../main/envelope.c /opt/esp/idf/components/json/cJSON/cJSON.c -o /tmp/t -lm && /tmp/t' 2>&1 | tail -2 > $$tmp/c.txt; \
if diff -q $$tmp/py.txt $$tmp/c.txt >/dev/null; then echo "envelope: C and Python agree"; rm -rf $$tmp; \ if diff -q $$tmp/py.txt $$tmp/c.txt >/dev/null; then echo "envelope: C and Python agree"; rm -rf $$tmp; \
else echo "envelope: MISMATCH"; diff $$tmp/py.txt $$tmp/c.txt; rm -rf $$tmp; exit 1; fi else echo "envelope: MISMATCH"; diff $$tmp/py.txt $$tmp/c.txt; rm -rf $$tmp; exit 1; fi
+3 -3
View File
@@ -1,18 +1,18 @@
# led-controller # led-controller
ESP32-S3 controller for LED drivers: W5500 Ethernet, web UI, I2S microphone beat detection and an ESP-NOW link to the drivers. The firmware lives in [`v2/`](v2/); see [`v2/docs/BENCH_TEST.md`](v2/docs/BENCH_TEST.md) for the bench tests. ESP32-S3 controller for LED drivers: W5500 Ethernet, web UI, I2S microphone beat detection and an ESP-NOW link to the drivers. The firmware is C (ESP-IDF) at the repository root; see [`docs/BENCH_TEST.md`](docs/BENCH_TEST.md) for the bench tests.
## Build and flash ## Build and flash
```bash ```bash
make build # minify the web UI from v2/web, then build the firmware (ESP-IDF in Docker) make build # minify the web UI from web/, then build the firmware (ESP-IDF in Docker)
make flash # flash over USB make flash # flash over USB
make ota HOST=<ip> # update firmware (web UI included) over Ethernet, no USB (POST /ota) make ota HOST=<ip> # update firmware (web UI included) over Ethernet, no USB (POST /ota)
make monitor # serial console make monitor # serial console
make test # driver unit tests and the C/Python envelope cross-check make test # driver unit tests and the C/Python envelope cross-check
``` ```
`make` lists every target. The web UI sources are in `v2/web/` (`static/`, `templates/`, `audio.html`). `make` lists every target. The web UI sources are in `web/` (`static/`, `templates/`, `audio.html`).
## Other directories ## Other directories
File renamed without changes.
+3 -3
View File
@@ -1,4 +1,4 @@
# v2 bench test: one S3 controller and one LED driver # Bench test: one S3 controller and one LED driver
This walks one ESP32-S3 controller (W5500 Ethernet, INMP441 mic) and one `led-driver` unit through flashing, a smoke test, a lossy-link test and a beat latency measurement. Nothing here has been run on hardware yet, so treat the expected numbers as targets to check, not results. This walks one ESP32-S3 controller (W5500 Ethernet, INMP441 mic) and one `led-driver` unit through flashing, a smoke test, a lossy-link test and a beat latency measurement. Nothing here has been run on hardware yet, so treat the expected numbers as targets to check, not results.
@@ -12,7 +12,7 @@ This walks one ESP32-S3 controller (W5500 Ethernet, INMP441 mic) and one `led-dr
**Channel rule.** ESP-NOW only works when both radios use the same channel. The p2p driver uses its `wifi_channel` setting (default 5); the controller's default is now 5 as well (`CONFIG_ESPNOW_CHANNEL` in `sdkconfig.defaults`). If your driver uses another channel, change the controller before building: **Channel rule.** ESP-NOW only works when both radios use the same channel. The p2p driver uses its `wifi_channel` setting (default 5); the controller's default is now 5 as well (`CONFIG_ESPNOW_CHANNEL` in `sdkconfig.defaults`). If your driver uses another channel, change the controller before building:
```bash ```bash
cd v2 && docker run --rm -v "$PWD":/project -w /project espressif/idf:v5.5.5 idf.py menuconfig docker run --rm -v "$PWD":/project -w /project espressif/idf:v5.5.5 idf.py menuconfig
``` ```
then *ESP-NOW config → Wi-Fi channel*. Alternatively set `CONFIG_ESPNOW_CHANNEL=<n>` in `sdkconfig.defaults` (delete `sdkconfig` after, so it is regenerated). To use the beat marker pin, also set `CONFIG_BEAT_TEST_GPIO` (for example 4) in the same menu. then *ESP-NOW config → Wi-Fi channel*. Alternatively set `CONFIG_ESPNOW_CHANNEL=<n>` in `sdkconfig.defaults` (delete `sdkconfig` after, so it is regenerated). To use the beat marker pin, also set `CONFIG_BEAT_TEST_GPIO` (for example 4) in the same menu.
@@ -22,7 +22,7 @@ then *ESP-NOW config → Wi-Fi channel*. Alternatively set `CONFIG_ESPNOW_CHANNE
The repository root has a Makefile that wraps all of this: `make build`, `make flash`, `make monitor` (Ctrl-] to quit), `make log` (console for 10 s, no terminal needed), `make test`, and `make help` for the rest; `PORT=/dev/ttyACM1` selects another port. The manual commands below do the same thing. The repository root has a Makefile that wraps all of this: `make build`, `make flash`, `make monitor` (Ctrl-] to quit), `make log` (console for 10 s, no terminal needed), `make test`, and `make help` for the rest; `PORT=/dev/ttyACM1` selects another port. The manual commands below do the same thing.
```bash ```bash
cd v2
tools/build_web.sh tools/build_web.sh
docker run --rm -v "$PWD":/project -w /project espressif/idf:v5.5.5 idf.py build docker run --rm -v "$PWD":/project -w /project espressif/idf:v5.5.5 idf.py build
``` ```
@@ -6,6 +6,6 @@ idf_component_register(SRCS "main.c" "mic.c" "beat.c" "beat_dsp.c" "espnow_tx.c"
# The gzipped web UI is embedded in the app image (run tools/build_web.sh first) # The gzipped web UI is embedded in the app image (run tools/build_web.sh first)
if(NOT EXISTS ${PROJECT_DIR}/www_dist/www.pack) if(NOT EXISTS ${PROJECT_DIR}/www_dist/www.pack)
message(FATAL_ERROR "www_dist/www.pack is missing: run v2/tools/build_web.sh (make build does)") message(FATAL_ERROR "www_dist/www.pack is missing: run tools/build_web.sh (make build does)")
endif() endif()
target_add_binary_data(${COMPONENT_LIB} ${PROJECT_DIR}/www_dist/www.pack BINARY) target_add_binary_data(${COMPONENT_LIB} ${PROJECT_DIR}/www_dist/www.pack BINARY)
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
Internal Server Error - Technical Kiwi Git Server
500 Internal Server Error

An error occurred:

An error occurred

Gitea Version: 28.2.0