diff --git a/gnss_thread.py b/gnss_thread.py index 7710017..afaecf0 100644 --- a/gnss_thread.py +++ b/gnss_thread.py @@ -34,9 +34,7 @@ class GnssReader(QThread): chunk = self._transport.read(512) frames = self.packetizer.on_recv(chunk) res = extract_satellites(frames) - if 'sat' in res: - self.satellites_updated.emit(res) - if 'dop' in res: + if res: self.satellites_updated.emit(res) except (serial.SerialException, OSError, ConnectionRefusedError, diff --git a/plot_tab.py b/plot_tab.py index 6dcfa7f..2996278 100644 --- a/plot_tab.py +++ b/plot_tab.py @@ -228,22 +228,7 @@ class SinglePlotPanel(QWidget): h = self._history[key] color = CURVE_PALETTE[idx % len(CURVE_PALETTE)] active = h.get("active", True) - - if active: - pen = pg.mkPen(color=color, width=1, style=Qt.SolidLine) - else: - # Inaktiver SV: gestrichelte Linie bei y=0 - pen = pg.mkPen(color=color, width=1, style=Qt.DashLine) - x_data = h["x"] if h["x"] else [datetime.now().timestamp()] - y_data = [0.0] * len(x_data) - if key in self._curves: - self._curves[key].setData(x_data, y_data) - self._curves[key].setPen(pen) - else: - self._curves[key] = self._plot.plot( - x_data, y_data, pen=pen, name=f"{key} (weg)" - ) - continue + pen = pg.mkPen(color=color, width=1, style=Qt.SolidLine) if key not in self._curves: self._curves[key] = self._plot.plot( diff --git a/ubx.py b/ubx.py index 67cced0..f8db3c8 100644 --- a/ubx.py +++ b/ubx.py @@ -174,11 +174,12 @@ def parse_nav_dop(payload: bytes) -> dict: return res def extract_satellites(frames: list[dict]) -> dict: + res = {} for f in frames: if f["cls"] == UBX_CLASS_NAV and f["id"] == UBX_ID_NAV_SAT: - return {'sat': parse_nav_sat(f["payload"])} + res['sat'] = parse_nav_sat(f["payload"]) if f["cls"] == UBX_CLASS_NAV and f["id"] == UBX_ID_NAV_SVINFO: - return {'sat': parse_nav_svinfo(f["payload"])} + res['sat'] = parse_nav_svinfo(f["payload"]) if f["cls"] == UBX_CLASS_NAV and f["id"] == UBX_ID_NAV_DOP: - return {'dop': parse_nav_dop(f["payload"])} - return {} + res['dop'] = parse_nav_dop(f["payload"]) + return res