Simplify postfilter stuff

This commit is contained in:
atse 2023-10-16 11:45:24 +08:00
parent bf0cb9ef05
commit c56a167824

View File

@ -236,8 +236,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
{'name': 'B', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'decimals': 4, 'param': ('s-h', ch, 'b')},
]},
{'name': 'Postfilter Config', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Postfilter Rate', 'type': 'list', 'value': ('rate', 16.67), 'param': ('postfilter', ch),
'limits': {'Off': ('off',), '16.67 Hz': ('rate', 16.67), '20 Hz': ('rate', 20.0), '21.25 Hz': ('rate', 21.25), '27 Hz': ('rate', 27.0)}},
{'name': 'Postfilter Rate', 'type': 'list', 'value': 16.67, 'param': ('postfilter', ch, 'rate'),
'limits': {'Off': None, '16.67 Hz': 16.67, '20 Hz': 20.0, '21.25 Hz': 21.25, '27 Hz': 27.0}},
]},
{'name': 'PID Config', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Kp', 'type': 'float', 'step': 0.1, 'suffix': '', 'param': ('pid', ch, 'kp')},
@ -668,8 +668,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
data /= 1000 # Given in mA
thermostat_param = inner_param.opts["param"]
if inner_param.name() == 'Postfilter Rate':
set_param_args = (*thermostat_param, *data)
if inner_param.name() == 'Postfilter Rate' and data == None:
set_param_args = (*thermostat_param[:2], 'off')
elif inner_param.name() == 'Control Method':
set_param_args = thermostat_param
else:
@ -831,10 +831,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
for postfilter_params in postfilter_data:
channel = postfilter_params["channel"]
with QSignalBlocker(self.params[channel]):
if postfilter_params["rate"] == None:
self.params[channel].child("Postfilter Config", "Postfilter Rate").setValue(('off',))
else:
self.params[channel].child("Postfilter Config", "Postfilter Rate").setValue(('rate', postfilter_params["rate"]))
self.params[channel].child("Postfilter Config", "Postfilter Rate").setValue(postfilter_params["rate"])
async def coro_main():