better profile switching for the gui

This commit is contained in:
Jakob Ketterl 2019-11-23 17:22:20 +01:00
parent b27caf2405
commit 481918ab5b
3 changed files with 5 additions and 3 deletions

View File

@ -1067,7 +1067,7 @@ function on_ws_recv(evt) {
waterfall_clear(); waterfall_clear();
currentprofile = config['profile_id']; currentprofile = config['sdr_id'] + '|' + config['profile_id'];
$('#openwebrx-sdr-profiles-listbox').val(currentprofile); $('#openwebrx-sdr-profiles-listbox').val(currentprofile);
break; break;

View File

@ -70,6 +70,7 @@ class OpenWebRxReceiverClient(Client):
"mathbox_waterfall_history_length", "mathbox_waterfall_history_length",
"mathbox_waterfall_frequency_resolution", "mathbox_waterfall_frequency_resolution",
"initial_squelch_level", "initial_squelch_level",
"profile_id",
] ]
def __init__(self, conn): def __init__(self, conn):
@ -170,8 +171,8 @@ class OpenWebRxReceiverClient(Client):
config = dict((key, configProps[key]) for key in OpenWebRxReceiverClient.config_keys) config = dict((key, configProps[key]) for key in OpenWebRxReceiverClient.config_keys)
# TODO mathematical properties? hmmmm # TODO mathematical properties? hmmmm
config["start_offset_freq"] = configProps["start_freq"] - configProps["center_freq"] 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 # TODO this is a hack to support multiple sdrs
config["profile_id"] = self.sdr.getId() + "|" + self.sdr.getProfileId() config["sdr_id"] = self.sdr.getId()
self.write_config(config) self.write_config(config)
cf = configProps["center_freq"] cf = configProps["center_freq"]

View File

@ -172,6 +172,7 @@ class SdrSource(object):
logger.debug("activating profile {0}".format(profile_id)) logger.debug("activating profile {0}".format(profile_id))
self.profile_id = profile_id self.profile_id = profile_id
profile = profiles[profile_id] profile = profiles[profile_id]
self.props["profile_id"] = profile_id
for (key, value) in profile.items(): for (key, value) in profile.items():
# skip the name, that would overwrite the source name. # skip the name, that would overwrite the source name.
if key == "name": if key == "name":