allow frequency display precision to be set via configuration
This commit is contained in:
parent
05096c2a16
commit
23080dbe22
@ -269,6 +269,10 @@ waterfall_auto_level_margin = {"min": 3, "max": 10, "min_range": 50}
|
|||||||
# \_waterfall_auto_level_margin["min"]_/ |__ current_min_power_level | \_waterfall_auto_level_margin["max"]_/
|
# \_waterfall_auto_level_margin["min"]_/ |__ current_min_power_level | \_waterfall_auto_level_margin["max"]_/
|
||||||
# current_max_power_level __|
|
# current_max_power_level __|
|
||||||
|
|
||||||
|
# This setting allows you to modify the precision of the frequency displays in OpenWebRX.
|
||||||
|
# Set this to the number of digits you would like to see:
|
||||||
|
frequency_display_precision = 5
|
||||||
|
|
||||||
# This setting tells the auto-squelch the offset to add to the current signal level to use as the new squelch level.
|
# This setting tells the auto-squelch the offset to add to the current signal level to use as the new squelch level.
|
||||||
# Lowering this setting will give you a more sensitive squelch, but it may also cause unwanted squelch openings when
|
# Lowering this setting will give you a more sensitive squelch, but it may also cause unwanted squelch openings when
|
||||||
# using the auto squelch.
|
# using the auto squelch.
|
||||||
|
@ -11,6 +11,8 @@ function DemodulatorPanel(el) {
|
|||||||
self.getDemodulator().set_offset_frequency(freq - self.center_freq);
|
self.getDemodulator().set_offset_frequency(freq - self.center_freq);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.mouseFrequencyDisplay = el.find('.webrx-mouse-freq').frequencyDisplay();
|
||||||
|
|
||||||
Modes.registerModePanel(this);
|
Modes.registerModePanel(this);
|
||||||
el.on('click', '.openwebrx-demodulator-button', function() {
|
el.on('click', '.openwebrx-demodulator-button', function() {
|
||||||
var modulation = $(this).data('modulation');
|
var modulation = $(this).data('modulation');
|
||||||
@ -332,6 +334,15 @@ DemodulatorPanel.prototype.getSquelchMargin = function() {
|
|||||||
return this.squelchMargin;
|
return this.squelchMargin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DemodulatorPanel.prototype.setMouseFrequency = function(freq) {
|
||||||
|
this.mouseFrequencyDisplay.setFrequency(freq);
|
||||||
|
};
|
||||||
|
|
||||||
|
DemodulatorPanel.prototype.setFrequencyPrecision = function(precision) {
|
||||||
|
this.tuneableFrequencyDisplay.setFrequencyPrecision(precision);
|
||||||
|
this.mouseFrequencyDisplay.setFrequencyPrecision(precision);
|
||||||
|
};
|
||||||
|
|
||||||
$.fn.demodulatorPanel = function(){
|
$.fn.demodulatorPanel = function(){
|
||||||
if (!this.data('panel')) {
|
if (!this.data('panel')) {
|
||||||
this.data('panel', new DemodulatorPanel(this));
|
this.data('panel', new DemodulatorPanel(this));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
function FrequencyDisplay(element) {
|
function FrequencyDisplay(element) {
|
||||||
this.element = $(element);
|
this.element = $(element);
|
||||||
this.digits = [];
|
this.digits = [];
|
||||||
|
this.precision = 4;
|
||||||
this.setupElements();
|
this.setupElements();
|
||||||
this.setFrequency(0);
|
this.setFrequency(0);
|
||||||
}
|
}
|
||||||
@ -14,7 +15,10 @@ FrequencyDisplay.prototype.setupElements = function() {
|
|||||||
|
|
||||||
FrequencyDisplay.prototype.setFrequency = function(freq) {
|
FrequencyDisplay.prototype.setFrequency = function(freq) {
|
||||||
this.frequency = freq;
|
this.frequency = freq;
|
||||||
var formatted = (freq / 1e6).toLocaleString(undefined, {maximumFractionDigits: 4, minimumFractionDigits: 4});
|
var formatted = (freq / 1e6).toLocaleString(
|
||||||
|
undefined,
|
||||||
|
{maximumFractionDigits: this.precision, minimumFractionDigits: this.precision}
|
||||||
|
);
|
||||||
var children = this.digitContainer.children();
|
var children = this.digitContainer.children();
|
||||||
for (var i = 0; i < formatted.length; i++) {
|
for (var i = 0; i < formatted.length; i++) {
|
||||||
if (!this.digits[i]) {
|
if (!this.digits[i]) {
|
||||||
@ -34,6 +38,12 @@ FrequencyDisplay.prototype.setFrequency = function(freq) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FrequencyDisplay.prototype.setFrequencyPrecision = function(precision) {
|
||||||
|
if (!precision) return;
|
||||||
|
this.precision = precision;
|
||||||
|
this.setFrequency(this.frequency);
|
||||||
|
};
|
||||||
|
|
||||||
function TuneableFrequencyDisplay(element) {
|
function TuneableFrequencyDisplay(element) {
|
||||||
FrequencyDisplay.call(this, element);
|
FrequencyDisplay.call(this, element);
|
||||||
this.setupEvents();
|
this.setupEvents();
|
||||||
|
@ -292,7 +292,7 @@ function scale_canvas_mousemove(evt) {
|
|||||||
|
|
||||||
function frequency_container_mousemove(evt) {
|
function frequency_container_mousemove(evt) {
|
||||||
var frequency = center_freq + scale_offset_freq_from_px(evt.pageX);
|
var frequency = center_freq + scale_offset_freq_from_px(evt.pageX);
|
||||||
$('.webrx-mouse-freq').frequencyDisplay().setFrequency(frequency);
|
$('#openwebrx-panel-receiver').demodulatorPanel().setMouseFrequency(frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scale_canvas_end_drag(x) {
|
function scale_canvas_end_drag(x) {
|
||||||
@ -570,7 +570,7 @@ function canvas_mousemove(evt) {
|
|||||||
bookmarks.position();
|
bookmarks.position();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('.webrx-mouse-freq').frequencyDisplay().setFrequency(canvas_get_frequency(relativeX));
|
$('#openwebrx-panel-receiver').demodulatorPanel().setMouseFrequency(canvas_get_frequency(relativeX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,6 +734,8 @@ function on_ws_recv(evt) {
|
|||||||
currentprofile = config['sdr_id'] + '|' + config['profile_id'];
|
currentprofile = config['sdr_id'] + '|' + config['profile_id'];
|
||||||
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
|
$('#openwebrx-sdr-profiles-listbox').val(currentprofile);
|
||||||
|
|
||||||
|
$('#openwebrx-panel-receiver').demodulatorPanel().setFrequencyPrecision(config['frequency_display_precision']);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "secondary_config":
|
case "secondary_config":
|
||||||
var s = json['value'];
|
var s = json['value'];
|
||||||
@ -1241,7 +1243,6 @@ function openwebrx_init() {
|
|||||||
secondary_demod_init();
|
secondary_demod_init();
|
||||||
digimodes_init();
|
digimodes_init();
|
||||||
initPanels();
|
initPanels();
|
||||||
$('.webrx-mouse-freq').frequencyDisplay();
|
|
||||||
$('#openwebrx-panel-receiver').demodulatorPanel();
|
$('#openwebrx-panel-receiver').demodulatorPanel();
|
||||||
window.addEventListener("resize", openwebrx_resize);
|
window.addEventListener("resize", openwebrx_resize);
|
||||||
bookmarks = new BookmarkBar();
|
bookmarks = new BookmarkBar();
|
||||||
|
@ -124,6 +124,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||||||
"initial_squelch_level",
|
"initial_squelch_level",
|
||||||
"profile_id",
|
"profile_id",
|
||||||
"squelch_auto_margin",
|
"squelch_auto_margin",
|
||||||
|
"frequency_display_precision",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, conn):
|
def __init__(self, conn):
|
||||||
|
Loading…
Reference in New Issue
Block a user