forked from M-Labs/kirdy
driver: expose _odr_type for filter cfgs
This commit is contained in:
parent
4f19d2c2be
commit
cb2bc505c9
@ -80,13 +80,19 @@ class FilterConfig:
|
|||||||
f21sps = "F21SPS"
|
f21sps = "F21SPS"
|
||||||
f20sps = "F20SPS"
|
f20sps = "F20SPS"
|
||||||
f16sps = "F16SPS"
|
f16sps = "F16SPS"
|
||||||
|
_odr_type = "sinc5sinc1postfilter"
|
||||||
def _odr_type(self):
|
|
||||||
return "sinc5sinc1postfilter"
|
|
||||||
|
|
||||||
def _filter_type(self):
|
def _filter_type(self):
|
||||||
return "Sinc5Sinc1With50hz60HzRejection"
|
return "Sinc5Sinc1With50hz60HzRejection"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_list_of_settings(cls):
|
||||||
|
ret = []
|
||||||
|
for e in cls:
|
||||||
|
if e not in [cls._odr_type]:
|
||||||
|
ret.append(e)
|
||||||
|
return ret
|
||||||
|
|
||||||
class Sinc5Sinc1(StrEnum):
|
class Sinc5Sinc1(StrEnum):
|
||||||
f31250_0sps = "F31250_0SPS"
|
f31250_0sps = "F31250_0SPS"
|
||||||
f15625_0sps = "F15625_0SPS"
|
f15625_0sps = "F15625_0SPS"
|
||||||
@ -106,13 +112,19 @@ class FilterConfig:
|
|||||||
f5_0sps = "F5_0SPS"
|
f5_0sps = "F5_0SPS"
|
||||||
f2_5sps = "F2_5SPS"
|
f2_5sps = "F2_5SPS"
|
||||||
f1_25sps = "F1_25SPS"
|
f1_25sps = "F1_25SPS"
|
||||||
|
_odr_type = "sinc5sinc1odr"
|
||||||
def _odr_type(self):
|
|
||||||
return "sinc5sinc1odr"
|
|
||||||
|
|
||||||
def _filter_type(self):
|
def _filter_type(self):
|
||||||
return "Sinc5Sinc1"
|
return "Sinc5Sinc1"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_list_of_settings(cls):
|
||||||
|
ret = []
|
||||||
|
for e in cls:
|
||||||
|
if e not in [cls._odr_type]:
|
||||||
|
ret.append(e)
|
||||||
|
return ret
|
||||||
|
|
||||||
class Sinc3(StrEnum):
|
class Sinc3(StrEnum):
|
||||||
f31250_0sps = "F31250_0SPS"
|
f31250_0sps = "F31250_0SPS"
|
||||||
f15625_0sps = "F15625_0SPS"
|
f15625_0sps = "F15625_0SPS"
|
||||||
@ -132,23 +144,28 @@ class FilterConfig:
|
|||||||
f5_0sps = "F5_0SPS"
|
f5_0sps = "F5_0SPS"
|
||||||
f2_5sps = "F2_5SPS"
|
f2_5sps = "F2_5SPS"
|
||||||
f1_25sps = "F1_25SPS"
|
f1_25sps = "F1_25SPS"
|
||||||
|
_odr_type = "sinc3odr"
|
||||||
def _odr_type(self):
|
|
||||||
return "sinc3odr"
|
|
||||||
|
|
||||||
def _filter_type(self):
|
def _filter_type(self):
|
||||||
return "Sinc3"
|
return "Sinc3"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_list_of_settings(cls):
|
||||||
|
ret = []
|
||||||
|
for e in cls:
|
||||||
|
if e not in [cls._odr_type]:
|
||||||
|
ret.append(e)
|
||||||
|
return ret
|
||||||
|
|
||||||
class Sinc3WithFineODR():
|
class Sinc3WithFineODR():
|
||||||
upper_limit = 31250
|
upper_limit = 31250
|
||||||
lower_limit = 1.907465
|
lower_limit = 1.907465
|
||||||
|
_odr_type = "sinc3fineodr"
|
||||||
|
|
||||||
def __init__(self, rate):
|
def __init__(self, rate):
|
||||||
assert rate >= self.lower_limit and rate <= self.upper_limit
|
assert rate >= self.lower_limit and rate <= self.upper_limit
|
||||||
self.rate = float(rate)
|
self.rate = float(rate)
|
||||||
|
|
||||||
def _odr_type(self):
|
|
||||||
return "sinc3fineodr"
|
|
||||||
|
|
||||||
def _filter_type(self):
|
def _filter_type(self):
|
||||||
return "Sinc3WithFineODR"
|
return "Sinc3WithFineODR"
|
||||||
|
|
||||||
@ -614,12 +631,12 @@ class Thermostat:
|
|||||||
if hasattr(filter_config, 'rate'):
|
if hasattr(filter_config, 'rate'):
|
||||||
cmd[self._cmd.ConfigTempAdcFilter] = {
|
cmd[self._cmd.ConfigTempAdcFilter] = {
|
||||||
"filter_type": filter_config._filter_type(),
|
"filter_type": filter_config._filter_type(),
|
||||||
filter_config._odr_type(): filter_config.rate,
|
filter_config._odr_type: filter_config.rate,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
cmd[self._cmd.ConfigTempAdcFilter] = {
|
cmd[self._cmd.ConfigTempAdcFilter] = {
|
||||||
"filter_type": filter_config._filter_type(),
|
"filter_type": filter_config._filter_type(),
|
||||||
filter_config._odr_type(): filter_config,
|
filter_config._odr_type: filter_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
return await self._send_raw_cmd(cmd)
|
return await self._send_raw_cmd(cmd)
|
||||||
|
Loading…
Reference in New Issue
Block a user