make a more generic ExponentialInput and use that for the sample_rate input
This commit is contained in:
parent
7a0c934af5
commit
0537e23e38
@ -1,4 +1,4 @@
|
||||
$.fn.frequencyInput = function() {
|
||||
$.fn.exponentialInput = function() {
|
||||
var suffixes = {
|
||||
"K": 3,
|
||||
"M": 6,
|
||||
@ -9,7 +9,7 @@ $.fn.frequencyInput = function() {
|
||||
this.each(function(){
|
||||
var $group = $(this);
|
||||
var currentExponent = 0;
|
||||
$input = $group.find('input');
|
||||
var $input = $group.find('input');
|
||||
|
||||
var setExponent = function() {
|
||||
var newExponent = parseInt($exponent.val());
|
||||
@ -26,7 +26,7 @@ $.fn.frequencyInput = function() {
|
||||
}
|
||||
});
|
||||
|
||||
$exponent = $group.find('select.frequency-exponent');
|
||||
var $exponent = $group.find('select.exponent');
|
||||
$exponent.on('change', setExponent);
|
||||
|
||||
// calculate initial exponent
|
@ -7,5 +7,5 @@ $(function(){
|
||||
$('#rf_gain').gainInput();
|
||||
$('.optional-section').optionalSection();
|
||||
$('#scheduler').schedulerInput();
|
||||
$('.frequency-input').frequencyInput();
|
||||
$('.exponential-input').exponentialInput();
|
||||
});
|
@ -153,7 +153,7 @@ class CompiledAssetsController(GzipMixin, ModificationAwareController):
|
||||
"lib/settings/GainInput.js",
|
||||
"lib/settings/OptionalSection.js",
|
||||
"lib/settings/SchedulerInput.js",
|
||||
"lib/settings/FrequencyInput.js",
|
||||
"lib/settings/ExponentialInput.js",
|
||||
"settings.js",
|
||||
],
|
||||
}
|
||||
|
@ -321,9 +321,10 @@ class ModesInput(DropdownInput):
|
||||
super().__init__(id, label, options)
|
||||
|
||||
|
||||
class FrequencyInput(Input):
|
||||
def __init__(self, id, label, infotext=None):
|
||||
class ExponentialInput(Input):
|
||||
def __init__(self, id, label, unit, infotext=None):
|
||||
super().__init__(id, label, infotext=infotext)
|
||||
self.unit = unit
|
||||
|
||||
def defaultConverter(self):
|
||||
return IntConverter()
|
||||
@ -337,21 +338,22 @@ class FrequencyInput(Input):
|
||||
def render_input(self, value):
|
||||
append = """
|
||||
<div class="input-group-append">
|
||||
<select class="input-group-text frequency-exponent" name="{id}-exponent" {disabled}>
|
||||
<option value="0" selected>Hz</option>
|
||||
<option value="3">kHz</option>
|
||||
<option value="6">MHz</option>
|
||||
<option value="9">GHz</option>
|
||||
<option value="12">THz</option>
|
||||
<select class="input-group-text exponent" name="{id}-exponent" {disabled}>
|
||||
<option value="0" selected>{unit}</option>
|
||||
<option value="3">k{unit}</option>
|
||||
<option value="6">M{unit}</option>
|
||||
<option value="9">G{unit}</option>
|
||||
<option value="12">T{unit}</option>
|
||||
</select>
|
||||
</div>
|
||||
""".format(
|
||||
id=self.id,
|
||||
disabled="disabled" if self.disabled else "",
|
||||
unit=self.unit,
|
||||
)
|
||||
|
||||
return """
|
||||
<div class="input-group input-group-sm frequency-input">
|
||||
<div class="input-group input-group-sm exponential-input">
|
||||
{input}
|
||||
{append}
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@ from owrx.command import CommandMapper
|
||||
from owrx.socket import getAvailablePort
|
||||
from owrx.property import PropertyStack, PropertyLayer, PropertyFilter
|
||||
from owrx.property.filter import ByLambda
|
||||
from owrx.form import Input, TextInput, NumberInput, CheckboxInput, ModesInput, FrequencyInput
|
||||
from owrx.form import Input, TextInput, NumberInput, CheckboxInput, ModesInput, ExponentialInput
|
||||
from owrx.form.converter import OptionalConverter
|
||||
from owrx.form.device import GainInput, SchedulerInput, WaterfallLevelsInput
|
||||
from owrx.controllers.settings import Section
|
||||
@ -494,17 +494,18 @@ class SdrDeviceDescription(object):
|
||||
"services",
|
||||
"Run background services on this device",
|
||||
),
|
||||
FrequencyInput(
|
||||
ExponentialInput(
|
||||
"lfo_offset",
|
||||
"Oscilator offset",
|
||||
"Hz",
|
||||
infotext="Use this when the actual receiving frequency differs from the frequency to be tuned on the"
|
||||
+ " device. <br/> Formula: Center frequency + oscillator offset = sdr tune frequency",
|
||||
),
|
||||
WaterfallLevelsInput("waterfall_levels", "Waterfall levels"),
|
||||
SchedulerInput("scheduler", "Scheduler"),
|
||||
FrequencyInput("center_freq", "Center frequency"),
|
||||
NumberInput("samp_rate", "Sample rate", append="S/s"),
|
||||
FrequencyInput("start_freq", "Initial frequency"),
|
||||
ExponentialInput("center_freq", "Center frequency", "Hz"),
|
||||
ExponentialInput("samp_rate", "Sample rate", "S/s"),
|
||||
ExponentialInput("start_freq", "Initial frequency", "Hz"),
|
||||
ModesInput("start_mod", "Initial modulation"),
|
||||
NumberInput("initial_squelch_level", "Initial squelch level", append="dBFS"),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user