From 481918ab5be534c9c6d087c014db9bfd72326229 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 23 Nov 2019 17:22:20 +0100 Subject: [PATCH] better profile switching for the gui --- htdocs/openwebrx.js | 2 +- owrx/connection.py | 5 +++-- owrx/source.py | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 08dd94d..6512862 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1067,7 +1067,7 @@ function on_ws_recv(evt) { waterfall_clear(); - currentprofile = config['profile_id']; + currentprofile = config['sdr_id'] + '|' + config['profile_id']; $('#openwebrx-sdr-profiles-listbox').val(currentprofile); break; diff --git a/owrx/connection.py b/owrx/connection.py index a8e33e9..af98964 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -70,6 +70,7 @@ class OpenWebRxReceiverClient(Client): "mathbox_waterfall_history_length", "mathbox_waterfall_frequency_resolution", "initial_squelch_level", + "profile_id", ] def __init__(self, conn): @@ -170,8 +171,8 @@ class OpenWebRxReceiverClient(Client): config = dict((key, configProps[key]) for key in OpenWebRxReceiverClient.config_keys) # TODO mathematical properties? hmmmm config["start_offset_freq"] = configProps["start_freq"] - configProps["center_freq"] - # TODO this is a hack that only works because setting the profile always causes plenty of config change - config["profile_id"] = self.sdr.getId() + "|" + self.sdr.getProfileId() + # TODO this is a hack to support multiple sdrs + config["sdr_id"] = self.sdr.getId() self.write_config(config) cf = configProps["center_freq"] diff --git a/owrx/source.py b/owrx/source.py index fc228f5..424d057 100644 --- a/owrx/source.py +++ b/owrx/source.py @@ -172,6 +172,7 @@ class SdrSource(object): logger.debug("activating profile {0}".format(profile_id)) self.profile_id = profile_id profile = profiles[profile_id] + self.props["profile_id"] = profile_id for (key, value) in profile.items(): # skip the name, that would overwrite the source name. if key == "name":