30 Flock Safety infrastructure OUIs discovered through 2.4 GHz
promiscuous-mode analysis by @NitekryDPaul, including the addr1
receiver-side detection technique that catches Flock STAs during
their burst-sleep duty cycles when addr2-only sniffs miss them.
30 Flock Safety infrastructure OUIs identified by @NitekryDPaul via
2.4 GHz promiscuous-mode analysis, including the addr1-receiver
detection technique that catches Flock STAs during burst-sleep
duty cycles. Full credit and methodology in the new file.
Fix GPS not tagging all detections:
- Add dedicated fyGPSMutex guarding fyGPSLat/Lon/Acc/Valid/LastUpdate
- fyGPSSnapshot() + fyGPSUpdate() replace direct global reads/writes,
eliminating the race between BLE callback (reader) and /api/gps
HTTP handler (writer)
- fyBackfillGPS() runs every 2s in loop(), stamping any detection that
was recorded before the first phone GPS fix became available
- BLE callback JSON emitter now uses snapshot instead of raw globals
Make data saving/transfer bulletproof:
- New envelope format: header line {v,count,bytes,crc32} + payload array
- CRC32 verification catches any truncation or corruption on read
- Atomic write: compute CRC pass 1, write tmp + verify, then rename to
final (SPIFFS.rename with copy+delete fallback)
- Boot-time recovery: if session.json is missing/corrupt, recover from
session.tmp; legacy raw-array files still load for back-compat
- Save cadence tightened: within 5s of first detection, after any new
unique detection (3s throttle), and periodic safety net every 15s
- Export mutex timeouts raised 200->500ms to prevent empty CSV/JSON
exports under heavy BLE traffic
- /api/history and /api/history/kml strip envelope header before
returning body so downstream tools keep working unchanged
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Low-confidence mac_prefix_mfr hits no longer update fyLastDetTime/fyLastHB,
preventing them from keeping the heartbeat alive after a high-confidence
device leaves range. Bump FYDetection::method from 24 to 32 bytes so
"mac_prefix_soundthinking" (23 chars) has headroom.
- fyPromotePrevSession now reads session.json, writes to prev_session.json,
then deletes the original — SPIFFS.rename() silently fails on ESP32
- prior session KML export: added style defs, raven metadata, error handling,
moved file validation before response stream init
- reduced auto-save interval 60s → 15s, added 5s quick-save on first detection
Address Copilot review: contract manufacturer OUIs (Liteon/USI) are now
in a separate flock_mfr_mac_prefixes[] array emitting "mac_prefix_mfr"
as the detection method. SoundThinking/ShotSpotter gets its own array
and "mac_prefix_soundthinking" method. Low-confidence detections (mfr
OUIs) suppress buzzer/heartbeat but still emit JSON events so consumers
can apply their own thresholds.
Collapse the two-branch snprintf into a single call so every
detection message includes is_raven (true/false) and raven_fw,
making the format self-describing regardless of device type.
BLE server callbacks run on the NimBLE host task, not the Arduino
loop task. Calling WiFi state changes and delay() from that context
can stall BLE processing or trip watchdogs, and mutating scan
duration creates a cross-task data race.
Fix: callbacks now just set a volatile pending flag. The actual
WiFi/scan changes are applied in loop() where they're safe.
Expand MAC prefix detection with entries sourced from:
- Flock WiFi (Liteon/USI): f4:6a:dd, f8:a2:d6, e0:0a:f6, 00:f4:8d,
d0:39:57, e8:d0:fc — contract manufacturer OUIs (Liteon Technology and
USI/Universal Scientific Industrial) identified via the OUI-SPY firmware
ecosystem table and cross-referenced against the IEEE OUI registry.
These manufacturers produce Flock Safety's WiFi-enabled camera hardware.
- Flock Safety direct: b4:1e:52 — registered directly to "Flock Safety"
in the IEEE OUI database (MA-L assignment). This is their own prefix
rather than a contract manufacturer's.
- SoundThinking/ShotSpotter: d4:11:d6 — registered to "SoundThinking Inc"
(formerly ShotSpotter) in the IEEE OUI database. Their acoustic gunshot
detection sensors use BLE for local diagnostics and provisioning.
Enable DeFlock mobile app connectivity via BLE GATT notifications,
and desktop host detection via USB serial heartbeat. When a companion
is connected, WiFi AP is disabled to free radio bandwidth and BLE
scan duty cycle is increased for better detection performance.
- BLE GATT server advertising service UUID a1b2c3d4-e5f6-7890-abcd-ef0123456789
with TX characteristic (NOTIFY) for streaming detection JSON
- Chunked BLE notification sender respecting negotiated MTU
- "event":"detection" field added to JSON output for DeFlock parser
- Serial host detection via heartbeat timeout (5s)
- Companion mode: WiFi AP off + scan duration 2s→3s when connected
- Scan interval/duration converted from #define to mutable variables
Complete rewrite of standalone Flock-You firmware:
- Remove WiFi promiscuous mode, all detection is now BLE-only
- Add web dashboard served on AP "flockyou" at 192.168.4.1
- GPS wardriving via phone browser Geolocation API
- SPIFFS session persistence with auto-save every 60s
- Prior session tab (PREV) survives reboots
- KML export for Google Earth (current + prior session)
- JSON/CSV export with GPS coordinates
- Serial JSON output for Flask live ingestion
- Crow call boot sounds with detection/heartbeat alerts
- 200 unique device storage with FreeRTOS mutex
- Flask app: add KML import endpoint, GPS data handling
- Update platformio.ini with AsyncWebServer, ArduinoJson 7, SPIFFS partition
- Rewrite README to reflect current functionality