From c56a1678248edeacd7c0fcf9e7f07fe6da06cc11 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 16 Oct 2023 11:45:24 +0800 Subject: [PATCH] Simplify postfilter stuff --- pytec/tec_qt.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index b6922c3..63876c8 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -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():