Skip to content

Commit

Permalink
Display RNode hardware errors if available
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Oct 5, 2024
1 parent ca21e47 commit 86c3b18
Showing 1 changed file with 39 additions and 32 deletions.
71 changes: 39 additions & 32 deletions sbapp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def __init__(self, **kwargs):
self.hardware_rnode_ready = False
self.hardware_modem_ready = False
self.hardware_serial_ready = False
self.hw_error_dialog = None

self.final_load_completed = False
self.service_last_available = 0
Expand Down Expand Up @@ -432,22 +433,25 @@ def pm_job(dt):

def check_errors(dt):
if self.sideband.getpersistent("startup.errors.rnode") != None:
description = self.sideband.getpersistent("startup.errors.rnode")["description"]
self.sideband.setpersistent("startup.errors.rnode", None)
yes_button = MDRectangleFlatButton(
text="OK",
font_size=dp(18),
)
self.hw_error_dialog = MDDialog(
title="Hardware Error",
text="When starting a connected RNode, Reticulum reported the following error:\n\n[i]"+str(description)+"[/i]",
buttons=[ yes_button ],
# elevation=0,
)
def dl_yes(s):
self.hw_error_dialog.dismiss()
yes_button.bind(on_release=dl_yes)
self.hw_error_dialog.open()
if self.hw_error_dialog == None or (self.hw_error_dialog != None and not self.hw_error_dialog.is_open):
description = self.sideband.getpersistent("startup.errors.rnode")["description"]
self.sideband.setpersistent("startup.errors.rnode", None)
yes_button = MDRectangleFlatButton(
text="OK",
font_size=dp(18),
)
self.hw_error_dialog = MDDialog(
title="Hardware Error",
text="When starting a connected RNode, Reticulum reported the following error:\n\n[i]"+str(description)+"[/i]",
buttons=[ yes_button ],
# elevation=0,
)
def dl_yes(s):
self.hw_error_dialog.is_open = False
self.hw_error_dialog.dismiss()
yes_button.bind(on_release=dl_yes)
self.hw_error_dialog.open()
self.hw_error_dialog.is_open = True

Clock.schedule_once(check_errors, 1.5)

Expand Down Expand Up @@ -936,22 +940,25 @@ def dl_ok(s):
if RNS.vendor.platformutils.is_android():
rnode_errors = self.sideband.getpersistent("runtime.errors.rnode")
if rnode_errors != None:
description = rnode_errors["description"]
self.sideband.setpersistent("runtime.errors.rnode", None)
yes_button = MDRectangleFlatButton(
text="OK",
font_size=dp(18),
)
self.hw_error_dialog = MDDialog(
title="Hardware Error",
text="While connecting an RNode, Reticulum reported the following error:\n\n[i]"+str(description)+"[/i]",
buttons=[ yes_button ],
# elevation=0,
)
def dl_yes(s):
self.hw_error_dialog.dismiss()
yes_button.bind(on_release=dl_yes)
self.hw_error_dialog.open()
if self.hw_error_dialog == None or (self.hw_error_dialog != None and not self.hw_error_dialog.is_open):
description = rnode_errors["description"]
self.sideband.setpersistent("runtime.errors.rnode", None)
yes_button = MDRectangleFlatButton(
text="OK",
font_size=dp(18),
)
self.hw_error_dialog = MDDialog(
title="Hardware Error",
text="While communicating with an RNode, Reticulum reported the following error:\n\n[i]"+str(description)+"[/i]",
buttons=[ yes_button ],
# elevation=0,
)
def dl_yes(s):
self.hw_error_dialog.dismiss()
self.hw_error_dialog.is_open = False
yes_button.bind(on_release=dl_yes)
self.hw_error_dialog.open()
self.hw_error_dialog.is_open = True


if self.root.ids.screen_manager.current == "messages_screen":
Expand Down

0 comments on commit 86c3b18

Please sign in to comment.