P4-Nano: controller port with the C6 as ESP-NOW radio, and the simulator

The controller now builds for the Waveshare ESP32-P4-Nano only (plus the linux
sim and the desktop); the S3 stays for the USB/network bridge in bridge/.

- radio-c6/: C6 firmware, esp-hosted plus ESP-NOW over peer data. The P4 loads
  it from the slave_fw partition when the C6 runs another version (c6_update.c)
- bridge_hosted.c: the C6 as the always-on "c6" bridge, and the P4 as a network
  bridge on UDP 8766 for the desktop
- Ethernet on the P4's EMAC, ES8311 mic; default address 192.168.50.20. The
  W5500, INMP441 and direct ESP-NOW code is gone
- The simulated rig at /sim/ is built into the board image, with an always-on
  "browser" bridge. Its frames go through a queue so a slow page cannot hold up
  the radio, and frames for simulated bars are not sent over the C6. Receiver
  buffers are on the heap; a bar's flash file is only written when it changes
- HTTP server: more handlers, sockets and stack for the rig
- docs/P4_NANO.md, README and Makefile updated; graphify output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-24 21:45:25 +13:00
1 parent ba8e160aee
commit 4ab0c7c6d7
101 files changed
+3284 -971

No files matched your search

+26 -14
View File
@@ -1,9 +1,10 @@
# Build, flash and monitor the ESP32-S3 controller (ESP-IDF in Docker).
# Build, flash and monitor the controller on the Waveshare ESP32-P4-Nano (ESP-IDF in Docker; docs/P4_NANO.md).
# The S3 is only a bridge board now (bridge/, make bridge-build).
#
# make build, flash, then monitor (same as: make all)
# make help list the targets
# make build minify the web UI, then build the firmware
# make flash flash the last build to the S3 (does not build)
# make build minify the web UI, then build the C6 radio firmware and the controller
# make flash flash the last build to the P4 (does not build)
# make monitor serial console (Ctrl-] to quit)
# make flash-monitor
#
@@ -28,30 +29,33 @@ FIX_OWNER = chown -R $(OWNER) /project
# targets stop while one runs; FORCE=1 flashes anyway. -x matches the process name, cut to 15 characters.
APP_PROCS := led-controller|led_controller_
.PHONY: c6-build
.PHONY: all help no-app web build flash ota monitor flash-monitor log size menuconfig clean fullclean erase test test-driver test-envelope test-api test-browser sim-build sim sim-wasm sim-pack sim-web test-sim
# Default target: build, flash, then open the console (run in order, so not with make -j)
all: build flash monitor
help:
@echo "LED controller (ESP32-S3):"
@echo "LED controller (Waveshare ESP32-P4-Nano, docs/P4_NANO.md):"
@echo " make [all] build, flash, then open the console"
@echo " make build minify + gzip the web UI, then build the firmware"
@echo " make flash flash the last build (firmware and web UI) to PORT ($(PORT)); does not build"
@echo " make ota [HOST=ip] build, then upload the firmware (web UI included) over Ethernet (no USB);"
@echo " HOST defaults to led-controller.local"
@echo " make build minify + gzip the web UI, then build the C6 radio (radio-c6/) and the controller"
@echo " make flash flash the last build to PORT ($(PORT)), the C6 image included (loaded onto the"
@echo " C6 at boot); does not build"
@echo " make ota [HOST=ip] build, then upload the firmware (web UI included, not the C6 image) over Ethernet;"
@echo " HOST defaults to 192.168.50.20"
@echo " make monitor serial console on PORT (Ctrl-] to quit)"
@echo " make flash-monitor flash the last build, then open the console"
@echo " make log [SECS=10] print the console for SECS seconds and exit (no terminal needed)"
@echo " make web only rebuild the web UI (needs node/npx)"
@echo " make size memory use of the last build"
@echo " make menuconfig change the ESP-NOW channel, marker pin, W5500 pins, ..."
@echo " make menuconfig change the ESP-NOW channel, default IP, codec pins, ..."
@echo " make erase erase the whole flash (loses the stored data)"
@echo " make clean remove the build directory (keeps sdkconfig)"
@echo " make clean remove the build directories (keeps sdkconfig)"
@echo " make fullclean also remove sdkconfig and the web UI output"
@echo " make test driver unit tests + C/Python envelope cross-check"
@echo " make test-api HOST=ip HTTP API tests against a running controller (data restored afterwards)"
@echo " make test-browser HOST=ip Selenium UI tests against a running controller (needs selenium + chromedriver)"
@echo "USB/network ESP-NOW bridge boards (bridge/): make bridge-build, bridge-flash-s3 / bridge-flash-c3 BRIDGE=port"
@echo "Simulated rig (no hardware): the controller built for linux + led-simulator's 16 drivers over a UDP bridge"
@echo " make sim-build build the controller for the host (sim-controller/build/led_controller_sim.elf)"
@echo " make sim build, then run the headless rig and the controller (http://localhost:8080/)"
@@ -70,7 +74,14 @@ web:
# change just relinks), so drop its object and every build gets the current time.
APP_DESC_OBJ = build/esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj
build: web
# The C6 radio firmware (radio-c6/): flash writes it to the slave_fw partition, and the controller loads it onto
# the C6 when the C6 runs anything else (main/c6_update.c)
SLAVE_FW_OFFSET = 0xE40000
c6-build:
$(DOCKER_RUN) $(IDF_IMAGE) bash -c 'cd radio-c6; if [ ! -f build/CMakeCache.txt ]; then idf.py set-target esp32c6; fi; idf.py build; rc=$$?; $(FIX_OWNER); exit $$rc'
build: web sim-pack c6-build
$(DOCKER_RUN) $(IDF_IMAGE) bash -c 'rm -f $(APP_DESC_OBJ); idf.py build; rc=$$?; $(FIX_OWNER); exit $$rc'
no-app:
@@ -80,10 +91,11 @@ no-app:
exit 1; \
fi
# The controller, then the C6 image (esptool checks an image's chip, hence --force for the C6 one)
flash: no-app
$(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) bash -c 'idf.py -p $(PORT) flash; rc=$$?; $(FIX_OWNER); exit $$rc'
$(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) bash -c 'idf.py -p $(PORT) flash && esptool --chip esp32p4 -p $(PORT) -b 921600 write-flash --force $(SLAVE_FW_OFFSET) radio-c6/build/radio_c6.bin; rc=$$?; $(FIX_OWNER); exit $$rc'
ota: HOST ?= led-controller.local
ota: HOST ?= 192.168.50.20
ota: build
python3 tools/ota.py $(HOST)
@@ -106,7 +118,7 @@ erase: no-app
$(DOCKER_RUN) $(DEVICE) $(IDF_IMAGE) idf.py -p $(PORT) erase-flash
clean:
rm -rf build
rm -rf build radio-c6/build
fullclean: clean
rm -rf sdkconfig sdkconfig.old www_dist