From 19cae410622d8065f93c079711d2f880015a6bce Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 11 Dec 2024 21:56:41 +0100 Subject: [PATCH] Cleanup --- sbapp/sideband/core.py | 6 +++--- sbapp/ui/announces.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 85134c9..90da196 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -64,9 +64,9 @@ class PropagationNodeDetector(): # age = 0 pass - link_stats = {"rssi": self.reticulum.get_packet_rssi(announce_packet_hash), - "snr": self.reticulum.get_packet_snr(announce_packet_hash), - "q": self.reticulum.get_packet_q(announce_packet_hash)} + link_stats = {"rssi": self.owner_app.sideband.reticulum.get_packet_rssi(announce_packet_hash), + "snr": self.owner_app.sideband.reticulum.get_packet_snr(announce_packet_hash), + "q": self.owner_app.sideband.reticulum.get_packet_q(announce_packet_hash)} RNS.log("Detected active propagation node "+RNS.prettyhexrep(destination_hash)+" emission "+str(age)+" seconds ago, "+str(hops)+" hops away") self.owner.log_announce(destination_hash, app_data, dest_type=PropagationNodeDetector.aspect_filter, link_stats=link_stats) diff --git a/sbapp/ui/announces.py b/sbapp/ui/announces.py index be88712..f9bc28d 100644 --- a/sbapp/ui/announces.py +++ b/sbapp/ui/announces.py @@ -100,15 +100,15 @@ class Announces(): link_extras_full = "" if "extras" in announce and announce["extras"] != None: extras = announce["extras"] - RNS.log("Announce has extras: "+str(announce["extras"])) if "link_stats" in extras: link_stats = extras["link_stats"] if "rssi" in link_stats and "snr" in link_stats and "q" in link_stats: a_rssi = link_stats["rssi"] a_snr = link_stats["snr"] a_q = link_stats["q"] - link_extras_str = f" ([b]RSSI[/b] {a_rssi} [b]SNR[/b] {a_snr})" - link_extras_full = f"\n[b]Link Quality[/b] {a_q}%[/b]\n[b]RSSI[/b] {a_rssi}\n[b]SNR[/b] {a_snr}" + if a_rssi != None and a_snr != None and a_q != None: + link_extras_str = f" ([b]RSSI[/b] {a_rssi} [b]SNR[/b] {a_snr})" + link_extras_full = f"\n[b]Link Quality[/b] {a_q}%[/b]\n[b]RSSI[/b] {a_rssi}\n[b]SNR[/b] {a_snr}" sig_icon = multilingual_markup(sig_icon_for_q(a_q).encode("utf-8")).decode("utf-8")