New firmware/esp32p4-sensor-node/ ESP-IDF (C, FreeRTOS) project skeleton per docs/superpowers/specs/2026-07-23-esp32-sensor-node-design.md's Workstream I: - Wi-Fi station-mode connect with exponential-backoff reconnect (wifi_manager.c), credentials from a gitignored main/device_config.h the seeker fills in (template: device_config.h.example). - Telemetry HTTP client (telemetry_client.c) POSTing the spec's exact contract shape to /api/device/telemetry with a Bearer token, via esp_http_client + cJSON. - BME280 I2C driver (bme280.c) with Bosch's public double-precision compensation formulas, using ESP-IDF's newer driver/i2c_master.h API. - LD2410 mmWave presence driver (ld2410.c) over UART, chosen over a plain PIR for its distance/motion data richness — its frame-offset parsing is flagged as the least-certain code in the firmware. - sensor_driver_t registry (sensor_driver.h, sensor_registry.c) so new sensors are a new driver file + one array line, no main-loop changes. - README.md: build steps, manual-config walkthrough, wiring/pinouts, and an explicit "what's verified vs. not" section plus a real hardware caveat (ESP32-P4 has no integrated Wi-Fi radio). UNVERIFIED AGAINST REAL HARDWARE per the spec's honesty-policy note — no ESP-IDF toolchain or physical boards available in this environment. Syntax-checked with gcc against hand-written ESP-IDF API stubs (not committed) as a best-effort substitute for a real idf.py build. Workstream J (RTL-SDR experimental module) is explicitly out of scope here; firmware/esp32p4-sensor-node/components/ is left in place for it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
43 lines
2.2 KiB
Plaintext
43 lines
2.2 KiB
Plaintext
// Quantumancy sensor node — per-device configuration TEMPLATE.
|
|
//
|
|
// HOW TO USE THIS FILE (there is no provisioning UI in this build — see
|
|
// README.md's "Manual configuration" section for the full walkthrough):
|
|
//
|
|
// 1. Copy this file to `device_config.h` in this same directory:
|
|
// cp device_config.h.example device_config.h
|
|
// 2. Edit device_config.h and fill in YOUR OWN values below.
|
|
// 3. `device_config.h` is listed in .gitignore — it will not be committed.
|
|
// Never paste real credentials or tokens into this .example file.
|
|
// 4. Build and flash as normal (idf.py build flash).
|
|
//
|
|
// The pairing token comes from the Quantumancy web app: sign in, create a
|
|
// device from your account (name + optional sensor-type hint), and the
|
|
// backend shows you a raw pairing token EXACTLY ONCE. Copy it straight into
|
|
// DEVICE_PAIRING_TOKEN below — the backend only ever stores a hash of it, so
|
|
// if you lose it your only recourse is deleting the device and pairing a new
|
|
// one.
|
|
|
|
#pragma once
|
|
|
|
// --- Wi-Fi station credentials -------------------------------------------
|
|
// The device joins this network in station mode (it does not host an AP).
|
|
#define DEVICE_WIFI_SSID "your-wifi-ssid-here"
|
|
#define DEVICE_WIFI_PASSWORD "your-wifi-password-here"
|
|
|
|
// --- Quantumancy backend ---------------------------------------------------
|
|
// Base URL of the backend, NO trailing slash. The firmware appends
|
|
// "/api/device/telemetry" itself. Use https:// in any real deployment.
|
|
#define DEVICE_BACKEND_BASE_URL "https://your-quantumancy-host.example.com"
|
|
|
|
// One-time raw pairing token shown by the web app when you create this
|
|
// device (POST /api/device). Sent as `Authorization: Bearer <token>` on
|
|
// every telemetry POST. Treat it like a password.
|
|
#define DEVICE_PAIRING_TOKEN "paste-your-one-time-pairing-token-here"
|
|
|
|
// --- Reporting cadence -----------------------------------------------------
|
|
// How often (seconds) the telemetry task samples every registered sensor
|
|
// driver and POSTs a fresh readings batch. The contract caps 1 req/s
|
|
// sustained per device on the backend side — anything >= 2s here is safely
|
|
// inside that budget with room for retries.
|
|
#define DEVICE_REPORT_INTERVAL_SEC 15
|