switch when profile OR sdr has changed

This commit is contained in:
Jakob Ketterl 2021-01-30 16:17:05 +01:00
parent 142ca578ec
commit 881637811f

View File

@ -684,7 +684,11 @@ function zoom_calc() {
} }
var networkSpeedMeasurement; var networkSpeedMeasurement;
var currentprofile; var currentprofile = {
toString: function() {
return this['sdr_id'] + '|' + this['profile_id'];
}
};
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
@ -756,9 +760,10 @@ function on_ws_recv(evt) {
demodulatorPanel.setSquelchMargin(config['squelch_auto_margin']); demodulatorPanel.setSquelchMargin(config['squelch_auto_margin']);
bookmarks.loadLocalBookmarks(); bookmarks.loadLocalBookmarks();
if ('sdr_id' in config && 'profile_id' in config) { if ('sdr_id' in config || 'profile_id' in config) {
currentprofile = config['sdr_id'] + '|' + config['profile_id']; currentprofile['sdr_id'] = config['sdr_id'] || current_profile['sdr_id'];
$('#openwebrx-sdr-profiles-listbox').val(currentprofile); currentprofile['profile_id'] = config['profile_id'] || current_profile['profile_id'];
$('#openwebrx-sdr-profiles-listbox').val(currentprofile.toString());
waterfall_clear(); waterfall_clear();
} }
@ -792,9 +797,7 @@ function on_ws_recv(evt) {
listbox.html(json['value'].map(function (profile) { listbox.html(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.toString());
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
}
break; break;
case "features": case "features":
Modes.setFeatures(json['value']); Modes.setFeatures(json['value']);