Added hardware error communication to UI and improved RNode cleanup on teardown

This commit is contained in:
Mark Qvist 2022-10-29 16:39:54 +02:00
parent 2cdc2bfb58
commit 76545fec4d
3 changed files with 28 additions and 3 deletions

View File

@ -1,5 +1,4 @@
# TODO: Reset
__debug_build__ = True
__debug_build__ = False
__disable_shaders__ = True
__version__ = "0.2.6"
__variant__ = "beta"

View File

@ -321,6 +321,7 @@ class SidebandService():
time.sleep(sleep_time)
self.sideband.cleanup()
self.release_locks()
SidebandService().start()

View File

@ -9,6 +9,8 @@ import sqlite3
import RNS.vendor.umsgpack as msgpack
import RNS.Interfaces.Interface as Interface
from .res import sideband_fb_data
if RNS.vendor.platformutils.get_platform() == "android":
from jnius import autoclass, cast
@ -396,7 +398,10 @@ class SidebandCore():
self.active_propagation_node = dest
self.config["last_lxmf_propagation_node"] = dest
self.message_router.set_outbound_propagation_node(dest)
self.owner_app.root.ids.settings_propagation_node_address.text = RNS.hexrep(dest, delimit=False)
if not self.is_service:
self.owner_app.root.ids.settings_propagation_node_address.text = RNS.hexrep(dest, delimit=False)
RNS.log("Active propagation node set to: "+RNS.prettyhexrep(dest))
self.__save_config()
except Exception as e:
@ -675,6 +680,13 @@ class SidebandCore():
try:
entry = result[0]
val = msgpack.unpackb(entry[1])
if val == None:
db = sqlite3.connect(self.db_path)
dbc = db.cursor()
query = "delete from persistent where (property=:uprop);"
dbc.execute(query, {"uprop": prop.encode("utf-8")})
db.commit()
return val
except Exception as e:
RNS.log("Could not unpack persistent value from database for property \""+str(prop)+"\". The contained exception was: "+str(e), RNS.LOG_ERROR)
@ -1372,6 +1384,14 @@ class SidebandCore():
self.reticulum._add_interface(rnodeinterface, mode = if_mode, ifac_netname = ifac_netname, ifac_netkey = ifac_netkey)
self.interface_rnode = rnodeinterface
if rnodeinterface != None:
if len(rnodeinterface.hw_errors) > 0:
self.setpersistent("startup.errors.rnode", rnodeinterface.hw_errors[0])
if self.interface_rnode.online:
self.interface_rnode.display_image(sideband_fb_data)
self.interface_rnode.enable_external_framebuffer()
except Exception as e:
RNS.log("Error while adding RNode Interface. The contained exception was: "+str(e))
self.interface_rnode = None
@ -1699,6 +1719,11 @@ class SidebandCore():
else:
return "Unknown"
def cleanup(self):
if RNS.vendor.platformutils.get_platform() == "android":
if not self.reticulum.is_connected_to_shared_instance:
RNS.Transport.detach_interfaces()
rns_config = """
[reticulum]
enable_transport = TRANSPORT_IS_ENABLED