fix: BUG-21 GPS-speed fallback in server route replay
This commit is contained in:
@@ -35,11 +35,13 @@ When CLOSED, move the entire entry to Resolved — don't duplicate.
|
||||
(`insert_tracking(gps_x, gps_y, speed=None, …)`) — there is no GPS-derived speed fallback, so
|
||||
the SPEED column stays NULL and the replay shows 0.0 km/h (`speed_source="gps"`).
|
||||
- **Data**: trip #9 has 723 points — 570 with OBD speed, 25 with speed=0, 128 with NULL speed.
|
||||
- **Fix (proposed)**:
|
||||
1. GPS-speed fallback in `_log_loop()` — when OBD speed is None/0 but GPS coords exist,
|
||||
compute speed from the previous position (haversine / elapsed time) and log that as SPEED,
|
||||
so the replay shows the real speed (sourced "gps").
|
||||
2. Investigate why the OBD adapter didn't recover for ~20 min (reconnect on stalled reads).
|
||||
- **Fix**: mirror the Pi's `route_points` GPS-speed fallback in the server's `get_trip_route()`
|
||||
(`server/modules/db.py`) — when OBD speed is missing, derive speed from the previous point's
|
||||
movement (haversine / elapsed time, ≥8 m, ≤220 km/h) so the replay shows the real speed
|
||||
instead of flatlining at 0 km/h. (The Pi's own replay already did this; only the portal was
|
||||
missing it.)
|
||||
- **Follow-up**: investigate why the OBD adapter didn't recover for ~20 min (reconnect on
|
||||
stalled reads).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user