Stabilize satellite target switching

This commit is contained in:
James Smith
2026-03-19 17:44:02 +00:00
parent 511cecb311
commit 8caec74c5c
2 changed files with 44 additions and 13 deletions

View File

@@ -566,8 +566,9 @@ def get_satellite_position():
except ValueError as e:
return api_error(str(e), 400)
sat_input = data.get('satellites', [])
include_track = bool(data.get('includeTrack', True))
sat_input = data.get('satellites', [])
include_track = bool(data.get('includeTrack', True))
prefer_realtime_api = bool(data.get('preferRealtimeApi', False))
observer = wgs84.latlon(lat, lon)
ts = None
@@ -579,8 +580,9 @@ def get_satellite_position():
for sat in sat_input:
sat_name, norad_id, tle_data = _resolve_satellite_request(sat, tracked_by_norad, tracked_by_name)
# Special handling for ISS - prefer real-time API, but fall back to TLE if offline.
if norad_id == 25544 or sat_name == 'ISS':
# Optional special handling for ISS. The dashboard does not enable this
# because external API latency can make live updates stall.
if prefer_realtime_api and (norad_id == 25544 or sat_name == 'ISS'):
iss_data = _fetch_iss_realtime(lat, lon)
if iss_data:
# Add orbit track if requested (using TLE for track prediction)