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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user