first commit

This commit is contained in:
Joren de Graaf
2026-10-09 15:37:57 +02:00
commit dad0001df1
25 changed files with 2222 additions and 0 deletions
@@ -0,0 +1,5 @@
# BoomCast sensor upload contract
See `../../../django/SENSOR_SUBMISSION_API.md` for the authoritative backend contract. The firmware sends HTTPS `POST /api/pending/` with `Authorization: Bearer <sensor token>` and multipart fields `sensor_id`, stable filename-derived `event_id`, `duration_seconds`, `firmware_version`, `trigger_type`, and `file` (16 kHz, mono, signed 16-bit PCM WAV). It sends UTC ISO 8601 `captured_at` for the start of the actual WAV, plus optional `capture_started_at`, `triggered_at`, and `queued_at`. Without a synchronized clock it sends `time_state=unknown`, and the server stores a null capture time.
HTTP 201 is the first durable Pending Review submission. HTTP 200 with `duplicate: true` acknowledges an existing submission. Both must return the exact `event_id`, a 36-character `submission_id`, and `status` of `pending` or `reviewed`; the firmware retains the WAV on any missing, malformed, or mismatched receipt. HTTP 401/403/409 and most other 4xx indicate configuration or validation failures and trigger a slow retry; 408/429, 5xx, timeouts, and TLS errors retry with bounded exponential backoff. The sensor token determines identity and owner, and an untrusted device location never becomes a trusted location.
@@ -0,0 +1,11 @@
# Waveshare non-touch V2 hardware
Target: ESP32-S3-ePaper-1.54 V2 (owner confirmed). Waveshare says V2 uses ESP32-S3-PICO-1-N8R8 with 8 MB flash and 8 MB PSRAM and that V1/V2 examples are not interchangeable. Source: https://docs.waveshare.com/ESP32-S3-ePaper-1.54
The pinned official support commit is `aaf395c1bbd86f7c5b7a2f9f0401241ff5c44956`. Its Arduino `08_Audio_Test` board configuration selects ES8311 with I2C SDA/SCL 47/48 and I2S BCLK 15, WS 38, DOUT 45, DIN 16, MCLK 14, PA 46. The official `04_SD_Card` example uses SDMMC CLK 39, D0 40, CMD 41. The sketch's `user_config.h` matches the official Arduino example for ePaper SPI and power gates. Do not copy M5Stack Atom Echo pins.
The codec API reports success/failure for a requested read, but not the actual byte count. The firmware clears the raw buffer, discards failed reads, and aborts an active clip; short successful reads cannot be measured through this wrapper. `AUDIO_MIC_SLOT=0` selects one fixed stereo slot. This assignment is **not physically verified**; inspect a V2 recording and slot levels before field deployment.
The firmware retains the Arduino sketch layout because the official support expects that structure and no PlatformIO toolchain is currently installed. Use Arduino IDE 2.x, Espressif ESP32 Arduino core 3.3.0, board `ESP32S3 Dev Module`, 8 MB flash, enabled 8 MB PSRAM, Waveshare's pinned LVGL8 (`lvgl` 8.4.0), and ArduinoJson 7.4.3. Run `./prepare_from_waveshare.sh` to copy the pinned official support. The copied support and build products are ignored by Git. The `codec_board` support has Espressif Modified MIT licensing, `esp_codec_dev` has Apache-2.0, ArduinoJson has MIT, and LVGL has MIT. The Waveshare repository has no top-level license statement; preserve upstream attribution and check redistribution terms before vendoring its files.
Build, flash, and serial monitor from Arduino IDE at 115200 baud. Arduino CLI 1.5.1 compiled this sketch with ESP32 core 3.3.0, `FlashSize=8M`, `PSRAM=opi`, and `PartitionScheme=default_8MB`. The reported program size was 1,350,599 bytes (40% of the selected application partition), with 99,368 bytes (30%) of global dynamic memory. A successful compile does not establish microphone, display, SD, TLS, or power behavior; no board was flashed.
@@ -0,0 +1,16 @@
# Physical V2 acceptance checklist — pending
- [ ] Confirm non-touch V2 marking, 8 MB flash and 8 MB PSRAM, and boot stability.
- [ ] Verify ES8311 microphone initialization and the actual slot assignment using known speech and impulse recordings.
- [ ] Capture and play a five-second WAV; check 16 kHz mono PCM header and duration.
- [ ] Verify 2.5-second pre-trigger and post-trigger content and startup short-preroll behavior.
- [ ] Interrupt power during both WAV and metadata writes; verify recovery and that incomplete files never upload.
- [ ] Fill SD card near the configured reserve and confirm a visible error without overwriting queued clips.
- [ ] Verify ePaper listening, recording, queued/offline, uploading, success, retry, and error states.
- [ ] Verify CA-backed HTTPS certificate and hostname validation, including an invalid certificate rejection.
- [ ] Send a real recording to Django; confirm correct sensor ownership, playback, classification, and Pending Review moderation.
- [ ] Retry the same event ID and verify only one submission; reject wrong tokens and malformed WAV files.
- [ ] Disable Wi-Fi during capture and restore it; confirm automatic queue drain and no lost clip.
- [ ] Repeat capture/upload/outage cycles while measuring free heap, PSRAM, largest free PSRAM block, and recovery after failures.
No physical-board test has been performed in this workspace.