Commit Graph

12 Commits

Author SHA1 Message Date
Colonel Panic 3bf6f6a5bd dashboard: env-configurable port, plus ?demo=1 preview mode
flockyou.py: bind host and listen port both read from env
(FLOCKYOU_HOST / FLOCKYOU_PORT, defaulting to 0.0.0.0:5000). Was a
hardcoded :5000 before, which collides with other Flask projects on
the same dev box — now you can run side-by-side instances or bind
to localhost only.

index.html: ?demo=1 query param seeds the dashboard with eight
synthetic detections covering every visual state (live wildcard-probe,
addr2, addr1 with/without GPS, replay/FLASH with/without GPS, replay/
RAM × 2) and reveals the device command toolbar so the polished layout
is browseable without flashing real hardware. Purely a front-end mock
— the command buttons still hit the real /api/flock/* endpoints, so
clicking them in demo mode produces the actual "device not connected"
error toast (that error path is itself part of the UI worth seeing).
Self-contained: a single initDemoMode() function gated on the query
param, called once at the end of DOMContentLoaded.

api/README.md: both features documented under Quick start so they're
discoverable without reading the source.
2026-05-10 20:44:34 -04:00
Colonel Panic 2d0131dafd host command protocol — pull SPIFFS history + live table over USB
Firmware (main.cpp): adds a line-based CMD:* protocol on the same
USB-CDC port that already streams live detection JSON, so Flask can pull
state without re-flashing:

  - CMD:STATUS         emits {"event":"status",...} with det count,
                        SPIFFS state, free heap, uptime, channel
  - CMD:VERSION        emits firmware identifier + compile-time constants
  - CMD:DUMP_LIVE      streams the in-RAM detection table as replay
                        JSON lines, then a replay_complete sentinel
  - CMD:DUMP_PREV      same, but reads /prev_session.json from SPIFFS
                        (parses the CRC envelope and the embedded array)
  - CMD:CLEAR_LIVE     wipes fyDet[] and dirties the autosave
  - CMD:CLEAR_PREV     deletes /prev_session.json and any /session.tmp

Implementation:

  - Minimal string-aware JSON object reader (string-aware brace counter,
    backslash handling) lifts entries from the SPIFFS array one at a
    time without slurping the whole file
  - jsonGetString / jsonGetInt field extractors over flat objects
  - emitReplayDetection() reuses the existing Flask schema and adds
    replay / replay_source / detection_count / device_first_ms /
    device_last_ms so the host can tell historical from live
  - serialCmdTick() runs once per loop() and only acts on completed
    lines — non-blocking and safe alongside the live detection path
  - dualPrintf buffer bumped 384 → 1024 B to fit the longer replay line
    (and to remove a latent truncation risk on a long-SSID live line)

Flask (api/flockyou.py): turns the protocol into REST endpoints and
ingests replayed detections without confusing them with live ones:

  - flock_reader now dispatches {"event":"status"|"version"|"clear"|
    "replay_complete"|"error"} responses to threading.Event slots, and
    routes {"replay":true,"detection_method":...} lines through a new
    add_replay_detection_from_serial() that skips GPS temporal matching,
    flags timestamp_source="device_replay", and merges into an existing
    fresher live entry instead of overwriting it
  - send_command(cmd, response_event_name, timeout) serializes one
    command at a time and blocks until the matching event arrives
  - new endpoints: /api/flock/{status,version,dump_prev,dump_live,
    clear_prev,clear_live}

Verified: pio run completes clean (RAM 19.1%, flash 12.0%); flockyou.py
passes py_compile. README documents the protocol, the per-event shape,
and the canonical post-wardrive dump_prev → clear_prev workflow.
2026-05-10 20:22:05 -04:00
Colonel Panic 3606f1f812 Overhaul firmware: BLE-only detection, web dashboard, GPS wardriving, session persistence
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
2026-02-07 12:53:58 -05:00
Colonel Panic f9aff089e6 Add files via upload 2025-11-12 21:14:08 -05:00
Luke Switzer 5a71668a3f fix the OUI db download
Fix error 418  "I'm a teapot" from rate limiting
2025-10-01 09:34:54 -06:00
Luke Switzer 3971c7d45d fix missing thread context 2025-09-29 05:29:56 -06:00
Colonel Panic 661def11eb Add files via upload 2025-08-29 20:37:40 -04:00
Colonel Panic 04d76e1274 Add files via upload 2025-08-29 16:23:04 -04:00
Colonel Panic 8497469d2e Add files via upload 2025-08-28 20:21:54 -04:00
Colonel Panic c919e3be9f Add files via upload 2025-08-26 13:13:13 -04:00
Colonel Panic 811540a913 Add files via upload 2025-08-23 21:31:33 -04:00
Colonel Panic 0ee2e6c664 Add files via upload 2025-08-23 14:47:43 -04:00