update profile dropdown box on changes
This commit is contained in:
parent
3e25f1ec42
commit
b80fd9c023
@ -1158,6 +1158,7 @@ debug_ws_data_received=0;
|
|||||||
debug_ws_time_start = 0;
|
debug_ws_time_start = 0;
|
||||||
max_clients_num=0;
|
max_clients_num=0;
|
||||||
client_num = 0;
|
client_num = 0;
|
||||||
|
var currentprofile;
|
||||||
|
|
||||||
var COMPRESS_FFT_PAD_N=10; //should be the same as in csdr.c
|
var COMPRESS_FFT_PAD_N=10; //should be the same as in csdr.c
|
||||||
|
|
||||||
@ -1210,6 +1211,9 @@ function on_ws_recv(evt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
waterfall_clear();
|
waterfall_clear();
|
||||||
|
|
||||||
|
currentprofile = config.profile_id;
|
||||||
|
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
|
||||||
break;
|
break;
|
||||||
case "secondary_config":
|
case "secondary_config":
|
||||||
window.secondary_fft_size = json.value.secondary_fft_size;
|
window.secondary_fft_size = json.value.secondary_fft_size;
|
||||||
@ -1241,6 +1245,9 @@ function on_ws_recv(evt)
|
|||||||
listbox.innerHTML = json.value.map(function(profile){
|
listbox.innerHTML = json.value.map(function(profile){
|
||||||
return '<option value="' + profile.id + '">' + profile.name + "</option>";
|
return '<option value="' + profile.id + '">' + profile.name + "</option>";
|
||||||
}).join("");
|
}).join("");
|
||||||
|
if (currentprofile) {
|
||||||
|
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "features":
|
case "features":
|
||||||
for (var feature in json.value) {
|
for (var feature in json.value) {
|
||||||
|
@ -164,6 +164,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
|
||||||
|
config["profile_id"] = self.sdr.getId() + "|" + self.sdr.getProfileId()
|
||||||
self.write_config(config)
|
self.write_config(config)
|
||||||
|
|
||||||
cf = configProps["center_freq"]
|
cf = configProps["center_freq"]
|
||||||
|
@ -89,7 +89,7 @@ class SdrService(object):
|
|||||||
props = SdrService.sdrProps[id]
|
props = SdrService.sdrProps[id]
|
||||||
className = "".join(x for x in props["type"].title() if x.isalnum()) + "Source"
|
className = "".join(x for x in props["type"].title() if x.isalnum()) + "Source"
|
||||||
cls = getattr(sys.modules[__name__], className)
|
cls = getattr(sys.modules[__name__], className)
|
||||||
SdrService.sources[id] = cls(props, SdrService.getNextPort())
|
SdrService.sources[id] = cls(id, props, SdrService.getNextPort())
|
||||||
return SdrService.sources
|
return SdrService.sources
|
||||||
|
|
||||||
|
|
||||||
@ -98,8 +98,10 @@ class SdrSourceException(Exception):
|
|||||||
|
|
||||||
|
|
||||||
class SdrSource(object):
|
class SdrSource(object):
|
||||||
def __init__(self, props, port):
|
def __init__(self, id, props, port):
|
||||||
|
self.id = id
|
||||||
self.props = props
|
self.props = props
|
||||||
|
self.profile_id = None
|
||||||
self.activateProfile()
|
self.activateProfile()
|
||||||
self.rtlProps = self.props.collect(
|
self.rtlProps = self.props.collect(
|
||||||
"samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain"
|
"samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain"
|
||||||
@ -131,7 +133,10 @@ class SdrSource(object):
|
|||||||
profiles = self.props["profiles"]
|
profiles = self.props["profiles"]
|
||||||
if profile_id is None:
|
if profile_id is None:
|
||||||
profile_id = list(profiles.keys())[0]
|
profile_id = list(profiles.keys())[0]
|
||||||
|
if profile_id == self.profile_id:
|
||||||
|
return;
|
||||||
logger.debug("activating profile {0}".format(profile_id))
|
logger.debug("activating profile {0}".format(profile_id))
|
||||||
|
self.profile_id = profile_id
|
||||||
profile = profiles[profile_id]
|
profile = profiles[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.
|
||||||
@ -139,6 +144,12 @@ class SdrSource(object):
|
|||||||
continue
|
continue
|
||||||
self.props[key] = value
|
self.props[key] = value
|
||||||
|
|
||||||
|
def getId(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
|
def getProfileId(self):
|
||||||
|
return self.profile_id
|
||||||
|
|
||||||
def getProfiles(self):
|
def getProfiles(self):
|
||||||
return self.props["profiles"]
|
return self.props["profiles"]
|
||||||
|
|
||||||
@ -291,7 +302,7 @@ class Resampler(SdrSource):
|
|||||||
props["samp_rate"] = if_samp_rate
|
props["samp_rate"] = if_samp_rate
|
||||||
|
|
||||||
self.sdr = sdr
|
self.sdr = sdr
|
||||||
super().__init__(props, port)
|
super().__init__(None, props, port)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.modificationLock.acquire()
|
self.modificationLock.acquire()
|
||||||
|
Loading…
Reference in New Issue
Block a user