Add GPS debug endpoint for troubleshooting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
James Smith
2026-01-02 17:25:27 +00:00
parent e01c651bb4
commit a83e0f5c9a

View File

@@ -189,10 +189,34 @@ def get_position():
else:
return jsonify({
'status': 'waiting',
'message': 'Waiting for GPS fix'
'message': 'Waiting for GPS fix - ensure GPS has clear view of sky'
})
@gps_bp.route('/debug')
def debug_gps():
"""Debug endpoint showing GPS reader state."""
reader = get_gps_reader()
if not reader:
return jsonify({
'reader': None,
'message': 'No GPS reader initialized'
})
position = reader.position
return jsonify({
'running': reader.is_running,
'device': reader.device_path,
'baudrate': reader.baudrate,
'has_position': position is not None,
'position': position.to_dict() if position else None,
'last_update': reader.last_update.isoformat() if reader.last_update else None,
'error': reader.error,
'callbacks_registered': len(reader._callbacks),
})
@gps_bp.route('/stream')
def stream_gps():
"""SSE stream of GPS position updates."""