change display precision behavior to reference Hertz
This commit is contained in:
parent
6bd47cf914
commit
d81f0ae96c
@ -353,9 +353,9 @@ DemodulatorPanel.prototype.setMouseFrequency = function(freq) {
|
||||
this.mouseFrequencyDisplay.setFrequency(freq);
|
||||
};
|
||||
|
||||
DemodulatorPanel.prototype.setFrequencyPrecision = function(precision) {
|
||||
this.tuneableFrequencyDisplay.setFrequencyPrecision(precision);
|
||||
this.mouseFrequencyDisplay.setFrequencyPrecision(precision);
|
||||
DemodulatorPanel.prototype.setTuningPrecision = function(precision) {
|
||||
this.tuneableFrequencyDisplay.setTuningPrecision(precision);
|
||||
this.mouseFrequencyDisplay.setTuningPrecision(precision);
|
||||
};
|
||||
|
||||
$.fn.demodulatorPanel = function(){
|
||||
|
@ -7,7 +7,7 @@ function FrequencyDisplay(element) {
|
||||
};
|
||||
this.element = $(element);
|
||||
this.digits = [];
|
||||
this.precision = 4;
|
||||
this.precision = 2;
|
||||
this.setupElements();
|
||||
this.setFrequency(0);
|
||||
}
|
||||
@ -31,9 +31,10 @@ FrequencyDisplay.prototype.setFrequency = function(freq) {
|
||||
this.frequency = freq;
|
||||
this.exponent = Math.floor(Math.log10(this.frequency) / 3) * 3;
|
||||
|
||||
var digits = Math.max(0, this.exponent - this.precision);
|
||||
var formatted = (freq / 10 ** this.exponent).toLocaleString(
|
||||
undefined,
|
||||
{maximumFractionDigits: this.precision, minimumFractionDigits: this.precision}
|
||||
{maximumFractionDigits: digits, minimumFractionDigits: digits}
|
||||
);
|
||||
var children = this.digitContainer.children();
|
||||
for (var i = 0; i < formatted.length; i++) {
|
||||
@ -55,8 +56,8 @@ FrequencyDisplay.prototype.setFrequency = function(freq) {
|
||||
this.unitContainer.text(' ' + this.getPrefix() + 'Hz');
|
||||
};
|
||||
|
||||
FrequencyDisplay.prototype.setFrequencyPrecision = function(precision) {
|
||||
if (!precision) return;
|
||||
FrequencyDisplay.prototype.setTuningPrecision = function(precision) {
|
||||
if (typeof(precision) == 'undefined') return;
|
||||
this.precision = precision;
|
||||
this.setFrequency(this.frequency);
|
||||
};
|
||||
|
@ -770,8 +770,8 @@ function on_ws_recv(evt) {
|
||||
waterfall_clear();
|
||||
}
|
||||
|
||||
if ('frequency_display_precision' in config)
|
||||
$('#openwebrx-panel-receiver').demodulatorPanel().setFrequencyPrecision(config['frequency_display_precision']);
|
||||
if ('tuning_precision' in config)
|
||||
$('#openwebrx-panel-receiver').demodulatorPanel().setTuningPrecision(config['tuning_precision']);
|
||||
|
||||
break;
|
||||
case "secondary_config":
|
||||
|
@ -2,7 +2,7 @@ from owrx.property import PropertyLayer
|
||||
|
||||
|
||||
defaultConfig = PropertyLayer(
|
||||
version=5,
|
||||
version=6,
|
||||
max_clients=20,
|
||||
receiver_name="[Callsign]",
|
||||
receiver_location="Budapest, Hungary",
|
||||
@ -25,7 +25,7 @@ defaultConfig = PropertyLayer(
|
||||
waterfall_scheme="GoogleTurboWaterfall",
|
||||
waterfall_levels=PropertyLayer(min=-88, max=-20),
|
||||
waterfall_auto_level_margin=PropertyLayer(min=3, max=10, min_range=50),
|
||||
frequency_display_precision=4,
|
||||
tuning_precision=2,
|
||||
squelch_auto_margin=10,
|
||||
nmux_memory=50,
|
||||
google_maps_api_key="",
|
||||
|
@ -89,13 +89,23 @@ class ConfigMigratorVersion4(ConfigMigrator):
|
||||
config["version"] = 5
|
||||
|
||||
|
||||
class ConfigMigratorVersion5(ConfigMigrator):
|
||||
def migrate(self, config):
|
||||
if "frequency_display_precision" in config:
|
||||
# old config was always in relation to the display in MHz (1e6 Hz, hence the 6)
|
||||
config["tuning_precision"] = 6 - config["frequency_display_precision"]
|
||||
del config["frequency_display_precision"]
|
||||
config["version"] = 6
|
||||
|
||||
|
||||
class Migrator(object):
|
||||
currentVersion = 5
|
||||
currentVersion = 6
|
||||
migrators = {
|
||||
1: ConfigMigratorVersion1(),
|
||||
2: ConfigMigratorVersion2(),
|
||||
3: ConfigMigratorVersion3(),
|
||||
4: ConfigMigratorVersion4(),
|
||||
5: ConfigMigratorVersion5(),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
@ -132,7 +132,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
||||
"audio_compression",
|
||||
"fft_compression",
|
||||
"max_clients",
|
||||
"frequency_display_precision",
|
||||
"tuning_precision",
|
||||
]
|
||||
|
||||
def __init__(self, conn):
|
||||
|
@ -126,10 +126,12 @@ class GeneralSettingsController(SettingsFormController):
|
||||
),
|
||||
Section(
|
||||
"Display settings",
|
||||
# TODO: custom input for this?
|
||||
NumberInput(
|
||||
"frequency_display_precision",
|
||||
"Frequency display precision",
|
||||
infotext="Number of decimal digits to show on the frequency display",
|
||||
"tuning_precision",
|
||||
"Tuning precision",
|
||||
infotext="Specifies the precision of the frequency tuning display as an exponent of 10, in Hertz. "
|
||||
+ "Setting this to 1 means 10Hz precision, 2 means 100Hz precision, etc.",
|
||||
),
|
||||
),
|
||||
Section(
|
||||
|
Loading…
Reference in New Issue
Block a user