send only necessary config changes
This commit is contained in:
parent
2c3146314b
commit
abb0813948
@ -4,6 +4,7 @@ function DemodulatorPanel(el) {
|
|||||||
self.demodulator = null;
|
self.demodulator = null;
|
||||||
self.mode = null;
|
self.mode = null;
|
||||||
self.squelchMargin = 10;
|
self.squelchMargin = 10;
|
||||||
|
self.initialParams = {};
|
||||||
|
|
||||||
var displayEl = el.find('.webrx-actual-freq')
|
var displayEl = el.find('.webrx-actual-freq')
|
||||||
this.tuneableFrequencyDisplay = displayEl.tuneableFrequencyDisplay();
|
this.tuneableFrequencyDisplay = displayEl.tuneableFrequencyDisplay();
|
||||||
@ -180,7 +181,7 @@ DemodulatorPanel.prototype.collectParams = function() {
|
|||||||
squelch_level: -150,
|
squelch_level: -150,
|
||||||
mod: 'nfm'
|
mod: 'nfm'
|
||||||
}
|
}
|
||||||
return $.extend(new Object(), defaults, this.initialParams || {}, this.transformHashParams(this.parseHash()));
|
return $.extend(new Object(), defaults, this.initialParams, this.transformHashParams(this.parseHash()));
|
||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.startDemodulator = function() {
|
DemodulatorPanel.prototype.startDemodulator = function() {
|
||||||
@ -206,7 +207,7 @@ DemodulatorPanel.prototype._apply = function(params) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.setInitialParams = function(params) {
|
DemodulatorPanel.prototype.setInitialParams = function(params) {
|
||||||
this.initialParams = params;
|
$.extend(this.initialParams, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.onHashChange = function() {
|
DemodulatorPanel.prototype.onHashChange = function() {
|
||||||
|
@ -700,41 +700,59 @@ function on_ws_recv(evt) {
|
|||||||
switch (json.type) {
|
switch (json.type) {
|
||||||
case "config":
|
case "config":
|
||||||
var config = json['value'];
|
var config = json['value'];
|
||||||
waterfall_colors = buildWaterfallColors(config['waterfall_colors']);
|
if ('waterfall_colors' in config)
|
||||||
waterfall_min_level_default = config['waterfall_min_level'];
|
waterfall_colors = buildWaterfallColors(config['waterfall_colors']);
|
||||||
waterfall_max_level_default = config['waterfall_max_level'];
|
if ('waterfall_min_level' in config)
|
||||||
waterfall_auto_level_margin = config['waterfall_auto_level_margin'];
|
waterfall_min_level_default = config['waterfall_min_level'];
|
||||||
|
if ('waterfall_max_level' in config)
|
||||||
|
waterfall_max_level_default = config['waterfall_max_level'];
|
||||||
|
if ('waterfall_auto_level_margin' in config)
|
||||||
|
waterfall_auto_level_margin = config['waterfall_auto_level_margin'];
|
||||||
waterfallColorsDefault();
|
waterfallColorsDefault();
|
||||||
|
|
||||||
var initial_demodulator_params = {
|
var initial_demodulator_params = {};
|
||||||
mod: config['start_mod'],
|
if ('start_mod' in config)
|
||||||
offset_frequency: config['start_offset_freq'],
|
initial_demodulator_params['mod'] = config['start_mod'];
|
||||||
squelch_level: Number.isInteger(config['initial_squelch_level']) ? config['initial_squelch_level'] : -150
|
if ('start_offset_freq' in config)
|
||||||
};
|
initial_demodulator_params['offset_frequency'] = config['start_offset_freq'];
|
||||||
|
if ('initial_squelch_level' in config)
|
||||||
|
initial_demodulator_params['squelch_level'] = Number.isInteger(config['initial_squelch_level']) ? config['initial_squelch_level'] : -150;
|
||||||
|
|
||||||
bandwidth = config['samp_rate'];
|
if ('samp_rate' in config)
|
||||||
center_freq = config['center_freq'];
|
bandwidth = config['samp_rate'];
|
||||||
fft_size = config['fft_size'];
|
if ('center_freq' in config)
|
||||||
var audio_compression = config['audio_compression'];
|
center_freq = config['center_freq'];
|
||||||
audioEngine.setCompression(audio_compression);
|
if ('fft_size' in config)
|
||||||
divlog("Audio stream is " + ((audio_compression === "adpcm") ? "compressed" : "uncompressed") + ".");
|
fft_size = config['fft_size'];
|
||||||
fft_compression = config['fft_compression'];
|
if ('audio_compresion' in config) {
|
||||||
divlog("FFT stream is " + ((fft_compression === "adpcm") ? "compressed" : "uncompressed") + ".");
|
var audio_compression = config['audio_compression'];
|
||||||
$('#openwebrx-bar-clients').progressbar().setMaxClients(config['max_clients']);
|
audioEngine.setCompression(audio_compression);
|
||||||
|
divlog("Audio stream is " + ((audio_compression === "adpcm") ? "compressed" : "uncompressed") + ".");
|
||||||
|
}
|
||||||
|
if ('fft_compression' in config) {
|
||||||
|
fft_compression = config['fft_compression'];
|
||||||
|
divlog("FFT stream is " + ((fft_compression === "adpcm") ? "compressed" : "uncompressed") + ".");
|
||||||
|
}
|
||||||
|
if ('max_clients' in config)
|
||||||
|
$('#openwebrx-bar-clients').progressbar().setMaxClients(config['max_clients']);
|
||||||
|
|
||||||
waterfall_init();
|
waterfall_init();
|
||||||
var demodulatorPanel = $('#openwebrx-panel-receiver').demodulatorPanel();
|
var demodulatorPanel = $('#openwebrx-panel-receiver').demodulatorPanel();
|
||||||
demodulatorPanel.setCenterFrequency(center_freq);
|
demodulatorPanel.setCenterFrequency(center_freq);
|
||||||
demodulatorPanel.setInitialParams(initial_demodulator_params);
|
demodulatorPanel.setInitialParams(initial_demodulator_params);
|
||||||
demodulatorPanel.setSquelchMargin(config['squelch_auto_margin']);
|
if ('squelch_auto_margin' in config)
|
||||||
|
demodulatorPanel.setSquelchMargin(config['squelch_auto_margin']);
|
||||||
bookmarks.loadLocalBookmarks();
|
bookmarks.loadLocalBookmarks();
|
||||||
|
|
||||||
waterfall_clear();
|
waterfall_clear();
|
||||||
|
|
||||||
currentprofile = config['sdr_id'] + '|' + config['profile_id'];
|
if ('sdr_id' in config && 'profile_id' in config) {
|
||||||
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
|
currentprofile = config['sdr_id'] + '|' + config['profile_id'];
|
||||||
|
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
|
||||||
|
}
|
||||||
|
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel().setFrequencyPrecision(config['frequency_display_precision']);
|
if ('frequency_display_precision' in config)
|
||||||
|
$('#openwebrx-panel-receiver').demodulatorPanel().setFrequencyPrecision(config['frequency_display_precision']);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "secondary_config":
|
case "secondary_config":
|
||||||
|
Loading…
Reference in New Issue
Block a user