correctly handle bookmarks with underlying mode in receiver
This commit is contained in:
parent
a54a5fd560
commit
258aebd0c3
@ -11,7 +11,7 @@ function BookmarkBar() {
|
|||||||
if (!b || !b.frequency || !b.modulation) return;
|
if (!b || !b.frequency || !b.modulation) return;
|
||||||
me.getDemodulator().set_offset_frequency(b.frequency - center_freq);
|
me.getDemodulator().set_offset_frequency(b.frequency - center_freq);
|
||||||
if (b.modulation) {
|
if (b.modulation) {
|
||||||
me.getDemodulatorPanel().setMode(b.modulation);
|
me.getDemodulatorPanel().setMode(b.modulation, b.underlying);
|
||||||
}
|
}
|
||||||
$bookmark.addClass('selected');
|
$bookmark.addClass('selected');
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,12 @@ function DemodulatorPanel(el) {
|
|||||||
el.on('click', '.openwebrx-demodulator-button', function() {
|
el.on('click', '.openwebrx-demodulator-button', function() {
|
||||||
var modulation = $(this).data('modulation');
|
var modulation = $(this).data('modulation');
|
||||||
if (modulation) {
|
if (modulation) {
|
||||||
self.setMode(modulation);
|
if (self.mode && self.mode.type === 'digimode' && self.mode.underlying.indexOf(modulation) >= 0) {
|
||||||
|
// keep the mode, just switch underlying modulation
|
||||||
|
self.setMode(self.mode.modulation, modulation)
|
||||||
|
} else {
|
||||||
|
self.setMode(modulation);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.disableDigiMode();
|
self.disableDigiMode();
|
||||||
}
|
}
|
||||||
@ -80,12 +85,13 @@ DemodulatorPanel.prototype.render = function() {
|
|||||||
this.el.find(".openwebrx-modes").html(html);
|
this.el.find(".openwebrx-modes").html(html);
|
||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.setMode = function(requestedModulation) {
|
DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingModulation) {
|
||||||
var mode = Modes.findByModulation(requestedModulation);
|
var mode = Modes.findByModulation(requestedModulation);
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.mode === mode) {
|
|
||||||
|
if (this.mode === mode && this.underlyingModulation === underlyingModulation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mode.isAvailable()) {
|
if (!mode.isAvailable()) {
|
||||||
@ -93,16 +99,15 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var modulation;
|
||||||
if (mode.type === 'digimode') {
|
if (mode.type === 'digimode') {
|
||||||
modulation = mode.underlying[0];
|
if (underlyingModulation) {
|
||||||
} else {
|
modulation = underlyingModulation
|
||||||
if (this.mode && this.mode.type === 'digimode' && this.mode.underlying.indexOf(requestedModulation) >= 0) {
|
|
||||||
// keep the mode, just switch underlying modulation
|
|
||||||
mode = this.mode;
|
|
||||||
modulation = requestedModulation;
|
|
||||||
} else {
|
} else {
|
||||||
modulation = mode.modulation;
|
modulation = mode.underlying[0];
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
modulation = mode.modulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
var current = this.collectParams();
|
var current = this.collectParams();
|
||||||
@ -142,6 +147,7 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation) {
|
|||||||
|
|
||||||
this.demodulator.start();
|
this.demodulator.start();
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
|
this.underlyingModulation = modulation;
|
||||||
|
|
||||||
this.updateButtons();
|
this.updateButtons();
|
||||||
this.updatePanels();
|
this.updatePanels();
|
||||||
@ -149,8 +155,6 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.disableDigiMode = function() {
|
DemodulatorPanel.prototype.disableDigiMode = function() {
|
||||||
// just a little trick to get out of the digimode
|
|
||||||
delete this.mode;
|
|
||||||
this.setMode(this.getDemodulator().get_modulation());
|
this.setMode(this.getDemodulator().get_modulation());
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,7 +207,11 @@ DemodulatorPanel.prototype.stopDemodulator = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DemodulatorPanel.prototype._apply = function(params) {
|
DemodulatorPanel.prototype._apply = function(params) {
|
||||||
this.setMode(params.mod);
|
if (params.secondary_mod) {
|
||||||
|
this.setMode(params.secondary_mod, params.mod)
|
||||||
|
} else {
|
||||||
|
this.setMode(params.mod);
|
||||||
|
}
|
||||||
this.getDemodulator().set_offset_frequency(params.offset_frequency);
|
this.getDemodulator().set_offset_frequency(params.offset_frequency);
|
||||||
this.getDemodulator().setSquelch(params.squelch_level);
|
this.getDemodulator().setSquelch(params.squelch_level);
|
||||||
this.updateButtons();
|
this.updateButtons();
|
||||||
@ -223,8 +231,9 @@ DemodulatorPanel.prototype.onHashChange = function() {
|
|||||||
|
|
||||||
DemodulatorPanel.prototype.transformHashParams = function(params) {
|
DemodulatorPanel.prototype.transformHashParams = function(params) {
|
||||||
var ret = {
|
var ret = {
|
||||||
mod: params.secondary_mod || params.mod
|
mod: params.mod
|
||||||
};
|
};
|
||||||
|
if (typeof(params.secondary_mod) !== 'undefined') ret.secondary_mod = params.secondary_mod;
|
||||||
if (typeof(params.offset_frequency) !== 'undefined') ret.offset_frequency = params.offset_frequency;
|
if (typeof(params.offset_frequency) !== 'undefined') ret.offset_frequency = params.offset_frequency;
|
||||||
if (typeof(params.sql) !== 'undefined') ret.squelch_level = parseInt(params.sql);
|
if (typeof(params.sql) !== 'undefined') ret.squelch_level = parseInt(params.sql);
|
||||||
return ret;
|
return ret;
|
||||||
@ -329,7 +338,7 @@ DemodulatorPanel.prototype.updateHash = function() {
|
|||||||
freq: demod.get_offset_frequency() + self.center_freq,
|
freq: demod.get_offset_frequency() + self.center_freq,
|
||||||
mod: demod.get_modulation(),
|
mod: demod.get_modulation(),
|
||||||
secondary_mod: demod.get_secondary_demod(),
|
secondary_mod: demod.get_secondary_demod(),
|
||||||
sql: demod.getSquelch(),
|
sql: demod.getSquelch()
|
||||||
}, function(value, key){
|
}, function(value, key){
|
||||||
if (typeof(value) === 'undefined' || value === false) return undefined;
|
if (typeof(value) === 'undefined' || value === false) return undefined;
|
||||||
return key + '=' + value;
|
return key + '=' + value;
|
||||||
|
@ -831,7 +831,8 @@ function on_ws_recv(evt) {
|
|||||||
return {
|
return {
|
||||||
name: d['mode'].toUpperCase(),
|
name: d['mode'].toUpperCase(),
|
||||||
modulation: d['mode'],
|
modulation: d['mode'],
|
||||||
frequency: d['frequency']
|
frequency: d['frequency'],
|
||||||
|
underlying: d['underlying']
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
bookmarks.replace_bookmarks(as_bookmarks, 'dial_frequencies');
|
bookmarks.replace_bookmarks(as_bookmarks, 'dial_frequencies');
|
||||||
|
Loading…
Reference in New Issue
Block a user