feat: log OBD speed before GPS fix so rolling starts aren't lost

- _log_loop: when GPS has no fix but OBD speed > 1, write speed-only rows
  (NULL coordinates) instead of dropping the motion
- insert_tracking: accept None gps_x/gps_y -> NULL GPSX/GPSY
- app_trip: keep NULL-coord rows through normalize; _segment returns 0 for
  missing coords; route_points drops them (no position to draw)
- tests: speed-only rows build a trip with max speed + zero distance
- docs: FEAT-12 + readme note; server already filters NULL-GPS safely
This commit is contained in:
Mathieu Moran
2026-08-13 02:02:45 -04:00
parent fa8ae0001a
commit 3d49764855
5 changed files with 64 additions and 6 deletions
+15
View File
@@ -31,6 +31,7 @@ dedicated PLAN.md phase (or fold it into the relevant existing work) and mark it
| FEAT-09 | `WONTFIX` | mDNS (yaris.local) on phone hotspot | — |
| FEAT-10 | `IDEA` | Home Assistant integration | unassigned |
| FEAT-11 | `SHIPPED` | Hotspot SSID/password settings + 5GHz WiFi role swap | Phase 27 |
| FEAT-12 | `SHIPPED` | Log OBD speed before GPS fix (rolling-start capture) | Phase 27 |
---
@@ -222,3 +223,17 @@ dedicated PLAN.md phase (or fold it into the relevant existing work) and mark it
`app_network.py` (uplink on wlan0, AP on wlan1), `install_netwatch.sh` (rebinds profiles).
### FEAT-12 — Log OBD speed before GPS fix (rolling-start capture)
- **Status**: `SHIPPED` 2026-08-13
- **Area**: `modules/app_sql.py` (`_log_loop`, `insert_tracking`), `modules/app_trip.py`
(`normalize_tracking_rows`, `_segment`, `route_points`)
- **What**: The tracking logger previously only wrote rows once GPS had a fix, so a rolling
start or mid-drive reboot lost the first ~1.5–2 min of movement (boot + GPS cold start).
Now, while GPS has no fix but OBD speed > 1 km/h, the logger writes speed-only rows with
NULL coordinates; trip building treats them as OBD-motion events (zero GPS distance). The
route polyline drops these rows (no position to draw).
- **Server parity note**: server `compute_trips_for_device` and `get_trip_route` already filter
`gps_lat IS NOT NULL`, so they safely ignore the NULL-coordinate rows — but the server's
recomputed trips don't yet include the speed-only leading motion (follow-up if needed).