mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-04-04 14:07:32 +00:00
implement some basic validation for the sample rate
This commit is contained in:
parent
79e81295d5
commit
374bbb599e
4 changed files with 46 additions and 9 deletions
|
|
@ -15,7 +15,7 @@ from owrx.property.filter import ByLambda
|
|||
from owrx.form.input import Input, TextInput, NumberInput, CheckboxInput, ModesInput, ExponentialInput
|
||||
from owrx.form.input.converter import OptionalConverter
|
||||
from owrx.form.input.device import GainInput, SchedulerInput, WaterfallLevelsInput
|
||||
from owrx.form.input.validator import RequiredValidator
|
||||
from owrx.form.input.validator import RequiredValidator, Range, RangeListValidator
|
||||
from owrx.form.input.converter import Converter
|
||||
from owrx.form.section import OptionalSection
|
||||
from owrx.feature import FeatureDetector
|
||||
|
|
@ -622,7 +622,12 @@ class SdrDeviceDescription(object):
|
|||
),
|
||||
SchedulerInput("scheduler", "Scheduler"),
|
||||
ExponentialInput("center_freq", "Center frequency", "Hz"),
|
||||
ExponentialInput("samp_rate", "Sample rate", "S/s"),
|
||||
ExponentialInput(
|
||||
"samp_rate",
|
||||
"Sample rate",
|
||||
"S/s",
|
||||
validator=RangeListValidator(self.getSampleRateRanges())
|
||||
),
|
||||
ExponentialInput("start_freq", "Initial frequency", "Hz"),
|
||||
ModesInput("start_mod", "Initial modulation"),
|
||||
NumberInput("initial_squelch_level", "Initial squelch level", append="dBFS"),
|
||||
|
|
@ -673,3 +678,7 @@ class SdrDeviceDescription(object):
|
|||
self.getProfileMandatoryKeys(),
|
||||
self.getProfileOptionalKeys(),
|
||||
)
|
||||
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# semi-sane default value. should be overridden with more specific values per device.
|
||||
return [Range(500000, 10000000)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue