Skip to content

Commit

Permalink
Merge pull request bitcraze#477 from jonasdn/jonasdn/382
Browse files Browse the repository at this point in the history
Read and set radio address from config if possible
  • Loading branch information
jonasdn authored Mar 10, 2021
2 parents 49de1f9 + fa572a1 commit 7e9d964
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/cfclient/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def __init__(self, *args):

self._connectivity_manager.connect_button_clicked.connect(self._connect)
self._connectivity_manager.scan_button_clicked.connect(self._scan)
self._set_address()

self._auto_reconnect_enabled = Config().get("auto_reconnect")
self.autoReconnectCheckBox.toggled.connect(
Expand Down Expand Up @@ -360,6 +361,17 @@ def __init__(self, *args):
self._theme_group.addAction(node)
self.menuThemes.addAction(node)

def _set_address(self):
address = 0xE7E7E7E7E7
try:
link_uri = Config().get("link_uri")
if len(link_uri) > 0:
address = int(link_uri.split('/')[-1], 16)
except Exception as err:
logger.warn('failed to parse address from config: %s' % str(err))
finally:
self.address.setValue(address)

def _theme_selected(self, *args):
""" Callback when a theme is selected. """
for checkbox in self._theme_checkboxes:
Expand Down

0 comments on commit 7e9d964

Please sign in to comment.