Commit graph

3 commits

Author SHA1 Message Date
jedarden
d83759899f fix(firmware): redesign partition table for 4MB flash; fix flash size in esptool.js
The XMC embedded flash on ESP32-S3 (QFN56) has JEDEC ID 164020 which esptool.js
does not recognise — it returns flash size -1 causing 'File doesn't fit in
available flash' before any bytes are written.

firmware/sdkconfig.defaults:
  CONFIG_ESPTOOLPY_FLASHSIZE 16MB → 4MB
  4MB is the minimum supported flash. The spi_flash check only panics when
  physical < header, so 4MB header is safe on 16MB boards as well.

firmware/partitions.csv:
  Redesigned to fit within 4MB flash:
    factory  0x010000–0x200000  (~1.9MB, fits current 1.7MB binary + 330KB headroom)
    ota_0    0x200000–0x3F0000  (~1.9MB, A/B OTA + rollback preserved)
    otadata  0x3F0000–0x3F2000  (8KB)
  Total flash used: 0x3F2000 (98.6% of 4MB). Drops ota_1 (was at 8MB, unusable
  on 4MB devices anyway); rollback still works factory↔ota_0.

dashboard/js/onboard.js:
  flashSize: 'detect' → '4MB'  (detect returned -1 for this chip's JEDEC ID;
  hardcoding '4MB' correctly sets the binary header for all supported boards)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 10:40:58 -04:00
jedarden
ee1caf6ed8 feat: dual-partition OTA rollback validation with 60s role timeout
Update partition layout to 4MB factory/ota_0/ota_1 partitions for larger
firmware images. Add a 60-second validation timer that starts after the
hello message is sent on boot from an OTA partition. The partition is only
marked valid (via esp_ota_mark_app_valid_cancel_rollback) after receiving
a role message from the mothership. If the timer expires without role
receipt, the partition stays unconfirmed and the bootloader rolls back to
the previous firmware on next reset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 01:43:29 -04:00
jedarden
f178496c83 feat(firmware): ESP32-S3 firmware skeleton with CSI/BLE/WebSocket
- State machine: 7-state lifecycle (BOOT→WIFI→DISCOVERY→CONNECTED,
  degraded modes WIFI_LOST/MOTHERSHIP_UNAVAILABLE/CAPTIVE_PORTAL)
- WiFi: STA connection with exponential backoff, mDNS discovery with
  cached IP fallback, captive portal AP for provisioning
- WebSocket: bidirectional comms, binary CSI frames (24B header + I/Q),
  JSON hello/health/ble/ota_status upstream, role/config/ota/reboot
  downstream, OTA task with progress reporting
- CSI: promiscuous mode capture, queue-based processing, passive BSSID
  filter, on-device variance tracking (Welford's) for motion hints
- BLE: passive scanning on Core 0, 60-device cache, 5s reporting
- NVS: 15-key schema with versioning, role/rate persistence

Complete: ESP32 firmware skeleton, passive radar, BLE scanning
Remaining: Dashboard skeleton, Docker packaging (Phase 1 items 5-6)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 07:20:55 -04:00