diff --git a/RNS/Interfaces/Android/RNodeInterface.py b/RNS/Interfaces/Android/RNodeInterface.py index a19013d..29077e0 100644 --- a/RNS/Interfaces/Android/RNodeInterface.py +++ b/RNS/Interfaces/Android/RNodeInterface.py @@ -500,6 +500,8 @@ class RNodeInterface(Interface): self.r_csma_cw_max = None self.r_current_rssi = None self.r_noise_floor = None + self.r_interference = None + self.r_interference_l = None self.r_temperature = None self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN @@ -1314,6 +1316,7 @@ class RNodeInterface(Interface): self.r_interference = None else: self.r_interference = ntf-RNodeInterface.RSSI_OFFSET + self.r_interference_l = [time.time(), self.r_interference] if self.r_interference != None: RNS.log(f"{self} Radio detected interference at {self.r_interference} dBm", RNS.LOG_DEBUG) diff --git a/RNS/Interfaces/RNodeInterface.py b/RNS/Interfaces/RNodeInterface.py index 8f942b6..829154e 100644 --- a/RNS/Interfaces/RNodeInterface.py +++ b/RNS/Interfaces/RNodeInterface.py @@ -276,6 +276,8 @@ class RNodeInterface(Interface): self.r_csma_cw_max = None self.r_current_rssi = None self.r_noise_floor = None + self.r_interference = None + self.r_interference_l = None self.r_battery_state = RNodeInterface.BATTERY_STATE_UNKNOWN self.r_battery_percent = 0 @@ -947,12 +949,13 @@ class RNodeInterface(Interface): self.r_interference = None else: self.r_interference = ntf-RNodeInterface.RSSI_OFFSET + self.r_interference_l = [time.time(), self.r_interference] if self.r_interference != None: RNS.log(f"{self} Radio detected interference at {self.r_interference} dBm", RNS.LOG_DEBUG) # TODO: Remove debug - # RNS.log(f"RSSI: {self.r_current_rssi}, Noise floor: {self.r_noise_floor}, Interference: {self.r_interference}", RNS.LOG_EXTREME) + # RNS.log(f"RSSI: {self.r_current_rssi}, Noise floor: {self.r_noise_floor}, Interference: {self.r_interference}", RNS.LOG_DEBUG) elif (command == KISS.CMD_STAT_PHYPRM): if (byte == KISS.FESC): escape = True diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index d412ac4..4797538 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -1028,6 +1028,13 @@ class Reticulum: if hasattr(interface, "r_noise_floor"): ifstats["noise_floor"] = interface.r_noise_floor + if hasattr(interface, "r_interference"): + ifstats["interference"] = interface.r_interference + + if hasattr(interface, "r_interference_l") and type(interface.r_interference_l) == list: + ifstats["interference_last_ts"] = interface.r_interference_l[0] + ifstats["interference_last_dbm"] = interface.r_interference_l[1] + if hasattr(interface, "cpu_temp"): ifstats["cpu_temp"] = interface.cpu_temp diff --git a/RNS/Utilities/rnstatus.py b/RNS/Utilities/rnstatus.py index 8499a56..717170f 100644 --- a/RNS/Utilities/rnstatus.py +++ b/RNS/Utilities/rnstatus.py @@ -327,10 +327,20 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json= print(" Rate : {ss}".format(ss=speed_str(ifstat["bitrate"]))) if "noise_floor" in ifstat: - if ifstat["noise_floor"] != None: - print(" Noise Fl. : {nfl} dBm".format(nfl=str(ifstat["noise_floor"]))) + if not "interference" in ifstat: nstr = "" else: - print(" Noise Fl. : Unknown") + nf = ifstat["interference"] + lstr = ", no interference" + if "interference_last_ts" in ifstat and "interference_last_dbm" in ifstat: + lago = time.time()-ifstat["interference_last_ts"] + ldbm = ifstat["interference_last_dbm"] + lstr = f"\n Intrfrnc. : {ldbm} dBm {RNS.prettytime(lago, compact=True)} ago" + + + nstr = f"\n Intrfrnc. : {nf} dBm" if nf else lstr + + if ifstat["noise_floor"] != None: print(" Noise Fl. : {nfl} dBm{ntr}".format(nfl=str(ifstat["noise_floor"]), ntr=nstr)) + else: print(" Noise Fl. : Unknown") if "cpu_load" in ifstat: if ifstat["cpu_load"] != None: print(" CPU load : {v} %".format(v=str(ifstat["cpu_load"])))