Files
Claude Worker claude2 e7a974e1be feat(plip): scenario hot-load via ESP-NOW
PLIP was out of scope by design (Wi-Fi/HTTP-only); brought back in by
request. New src/scenario_now.{h,cpp}: owns the single esp_now recv
callback (no MSG_* demux needed — PLIP has no legacy ESP-NOW traffic),
reassembles scenario_mesh frames ({seq:u16 LE, total:u16 LE} + <=236 B
payload, <=64 KiB, 5 s sender-silence timeout) in a worker task, then
persists to LittleFS /scenario.json (temp-then-rename). Optional
consumer hook for a future Runtime 3 engine; stored-and-logged without
one. network_task calls scenario_now_init() once the station is up
(idempotent, repeated on reconnect).

Build green: pio run (devkit_es8388), RAM 14.8%, Flash 63.1%.
2026-06-10 10:24:01 +02:00

38 lines
1.4 KiB
Markdown

# PLIP Firmware
ESP32 firmware for the retro telephone annex. Bringup target: ESP32-A1S
Audio Kit (ES8388 codec). End target: custom PCB with Si3210 SLIC.
See `README.md` for architecture, REST contract, pin map, and the
submodule conversion procedure when a remote URL is ready.
## Build
```bash
cd PLIP_FIRMWARE
pio run # compile
pio run -t upload # flash via USB
pio device monitor # serial @ 115200
```
## Source layout
| File | Role |
|------|------|
| `src/main.cpp` | `setup()` boots the three FreeRTOS tasks |
| `src/phone_task.cpp` | Off-hook GPIO interrupt + ring control |
| `src/audio_task.cpp` | ES8388 / Si3210 audio routing, drains a command queue |
| `src/network_task.cpp` | WiFi station + REST server (`/ring`, `/play`, `/stop`, `/status`) |
| `src/scenario_now.cpp` | ESP-NOW scenario hot-load receiver → LittleFS `/scenario.json` |
## Anti-patterns
- Hardcoding pin numbers in source — they live in `platformio.ini`
`build_flags` so the dev kit ↔ PCB swap stays mechanical.
- Adding I2S/SPI calls outside `audio_task` or `phone_task` — codec
access must stay single-threaded per peripheral.
- Skipping NVS for WiFi credentials in committed code. Compile-time
defaults are OK for local bringup but never merge them.
- Implementing OTA before the bringup loop (REST `/ring` round-trip) is
rock solid — chasing OTA bugs on top of audio bugs is misery.