gui: prune stale satellites from sky tab on each NAV-SAT update

Satellites that dropped out of a receiver's NAV-SAT report (set
below horizon, lost signal) were never removed from the sky tab's
store/trail/highlight-timer dicts, only on full receiver removal.
Over a long session this let ghost satellites accumulate without
bound, making table rebuilds and sky-plot rendering progressively
more expensive and the GUI increasingly laggy.
This commit is contained in:
2026-07-17 17:23:57 +02:00
parent f7af4e5b31
commit 51727f9e24
+12
View File
@@ -246,8 +246,10 @@ class SkyTab(QWidget):
def _on_sat_update(self, rid: str, sats: list): def _on_sat_update(self, rid: str, sats: list):
selected = self._selected_rids() selected = self._selected_rids()
current_keys = set()
for sat in sats: for sat in sats:
key = (rid, sat.gnss_id, sat.sv_id) key = (rid, sat.gnss_id, sat.sv_id)
current_keys.add(key)
self._store[key] = sat self._store[key] = sat
if key not in self._trail: if key not in self._trail:
self._trail[key] = deque(maxlen=_TRAIL_MAXLEN) self._trail[key] = deque(maxlen=_TRAIL_MAXLEN)
@@ -255,6 +257,16 @@ class SkyTab(QWidget):
if rid in selected: if rid in selected:
self._highlight_row(key) self._highlight_row(key)
# Drop satellites no longer reported for this receiver so ghost
# entries (set below horizon, lost signal) don't accumulate forever.
stale = [k for k in self._store if k[0] == rid and k not in current_keys]
for k in stale:
del self._store[k]
self._trail.pop(k, None)
t = self._hi_timers.pop(k, None)
if t:
t.stop()
self._sky.update_data(self._visible_sats(), self._active_trails()) self._sky.update_data(self._visible_sats(), self._active_trails())
self._update_info() self._update_info()
if not self._table_timer.isActive(): if not self._table_timer.isActive():