feat: add GPS status endpoint and dashboard indicator

- add /api/gps/status for thread/fix-age visibility
- surface GPS status in Pi health and live GPS cards
- add tests for app_gps status snapshots

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 18:18:14 -04:00
co-authored by Copilot
parent 675bffb4a4
commit be40bbc15f
6 changed files with 163 additions and 3 deletions
+11
View File
@@ -179,6 +179,17 @@ def get_fix_age():
return None if last_fix_at is None else time.monotonic() - last_fix_at
def get_status():
"""Snapshot of the current GPS/GNSS state for the local dashboard."""
return {
"thread_alive": _gps_thread.is_alive() if _gps_thread is not None else False,
"has_fix": LocationX is not None and LocationY is not None and last_fix_at is not None,
"latitude": LocationX,
"longitude": LocationY,
"fix_age_seconds": get_fix_age(),
}
def start_gps():
"""Start the background thread that continuously polls the SIM868 for a GNSS fix."""
global _gps_thread