Add portal web simulator, SPI bridges, and Pico firmware updates.

Bring the five-panel hex portal online with a browser 3D/schematic preview, Pi SPI backends, and renamed multi-panel Pico UDP firmware.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-30 14:54:51 +12:00
parent d5cab2efdf
commit 5094c7bcee
78 changed files with 62251 additions and 832 deletions

66
firmware/pico/README.md Normal file
View File

@@ -0,0 +1,66 @@
# Portal Pico firmware (Pico SDK)
C firmware for a **Pico + W5500 + WS2812** panel adapter under `firmware/pico/`.
Replaces the CircuitPython `adapter/code.py` path with native UDP + PIO WS2812.
## Hardware
| Signal | GPIO |
|--------|------|
| W5500 CS | GP9 |
| SPI1 SCK | GP10 |
| SPI1 MOSI | GP11 |
| SPI1 MISO | GP12 |
| W5500 RST | GP13 |
| Status LED | GP25 |
| WS2812 strip 0 | GP28 |
| WS2812 strip 1 | GP27 |
**Two strips** per Pico. Pixel count comes from each UDP frame.
`MAX_LEDS` (512) is capacity only — edit `board_config.h` to raise it.
## Build
```bash
# From repo root
make deploy PANEL_ID=0
make reset && make monitor
make build
```
Requires [pico-sdk](https://github.com/raspberrypi/pico-sdk) and `arm-none-eabi-gcc`.
UF2: `firmware/pico/build/panel.uf2`.
## Options
```bash
make deploy PANEL_ID=0 # 10.1.1.10
make deploy PANEL_ID=1 # 10.1.1.11
make deploy PANEL_ID=0 NO_DHCP=0
make deploy PANEL_ID=0 WS2812_PIN=26 WS2812_PIN1=28
```
| Panel | IP | MAC |
|-------|-----|-----|
| 0 | 10.1.1.10 | 02:50:52:54:4C:00 |
| 1 | 10.1.1.11 | 02:50:52:54:4C:01 |
| … | … | … |
| 4 | 10.1.1.14 | 02:50:52:54:4C:04 |
| 255 (bench) | 10.1.1.19 | 02:50:52:54:4C:FF |
## UDP protocol (port 50007)
| Payload | Action |
|---------|--------|
| **N×3 bytes** | Raw RGB → strip 0 |
| **1 + N×3 bytes** | `strip_id` + RGB (`0`/`1`, or `255` = all) |
| **5 bytes `PIN\\0` + gpio** | Bind strip 0 |
| **8 bytes `PIN\\0` + strip + gpio + len_lo + len_hi** | Bind strip (optional LED hint) |
| **4 bytes `SHOW`** | Reserved |
```bash
# Both strips on one Pico (strip0=GP28, strip1=GP27)
pipenv run python examples/panel_color_test.py --panel-index 0 --pins 28:405,27:351
```
Pi sends logical **RGB**. Firmware converts to **GRB** on the wire (`FORMAT_GRB`).