add inputs for perseus

This commit is contained in:
Jakob Ketterl 2021-02-24 23:54:46 +01:00
parent bccb87e660
commit 8c767be53a

View File

@ -1,5 +1,7 @@
from owrx.source.direct import DirectSource, DirectSourceDeviceDescription from owrx.source.direct import DirectSource, DirectSourceDeviceDescription
from owrx.command import Option from owrx.command import Option, Flag
from owrx.form import Input, DropdownEnum, DropdownInput, CheckboxInput
from typing import List
# #
@ -29,13 +31,46 @@ class PerseussdrSource(DirectSource):
"samp_rate": Option("-s"), "samp_rate": Option("-s"),
"tuner_freq": Option("-f"), "tuner_freq": Option("-f"),
"attenuator": Option("-u"), "attenuator": Option("-u"),
"adc_preamp": Option("-m"), "adc_preamp": Flag("-m"),
"adc_dither": Option("-x"), "adc_dither": Flag("-x"),
"wideband": Option("-w"), "wideband": Flag("-w"),
} }
) )
) )
class AttenuatorOptions(DropdownEnum):
ATTENUATOR_0 = 0
ATTENUATOR_10 = -10
ATTENUATOR_20 = -20
ATTENUATOR_30 = -30
def __str__(self):
return "{value} dB".format(value=self.value)
class PerseussdrDeviceDescription(DirectSourceDeviceDescription): class PerseussdrDeviceDescription(DirectSourceDeviceDescription):
pass def getInputs(self) -> List[Input]:
return super().getInputs() + [
DropdownInput("attenuator", "Attenuator", options=AttenuatorOptions),
CheckboxInput("adc_preamp", "Activate ADC preamp"),
CheckboxInput("adc_dither", "Enable ADC dithering"),
CheckboxInput("wideband", "Disable analog filters"),
]
def getOptionalKeys(self):
# no rf_gain
return [key for key in super().getOptionalKeys() if key != "rf_gain"] + [
"attenuator",
"adc_preamp",
"adc_dither",
"wideband",
]
def getProfileOptionalKeys(self):
return [key for key in super().getProfileOptionalKeys() if key != "rf_gain"] + [
"attenuator",
"adc_preamp",
"adc_dither",
"wideband",
]