From 4df651902a519f1e1397cd4fb630eb4da702a93d Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 29 Aug 2023 12:39:32 +0800 Subject: [PATCH] Postfilter option revamped --- pytec/tec_qt.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 46a4e2c..bee2c18 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -246,8 +246,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): {'name': 'B', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'param': [('s-h', ch, 'b')]}, ]}, {'name': 'Postfilter Config', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'Rate', 'type': 'float', 'value': 16.67, 'step': 0.01, 'suffix': 'Hz', - 'param': [('postfilter', ch, 'rate')]}, + {'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': 'PID Config', 'expanded': False, 'type': 'group', 'children': [ {'name': 'Kp', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°C/A', 'param': [('pid', ch, 'kp')]}, @@ -630,7 +630,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): if inner_param.opts.get("param", None) is not None: for thermostat_param in inner_param.opts["param"]: if len(thermostat_param) == 4: # To tack on prefixes to the data - await self.client.set_param(thermostat_param[0], thermostat_param[1], thermostat_param[2], f"{thermostat_param[3]}{data}") + await self.client.set_param(*thermostat_param[:3], f"{thermostat_param[3]}{data}") + elif inner_param.name() == 'Postfilter Rate': + await self.client.set_param(*thermostat_param, *data) else: await self.client.set_param(*thermostat_param, data) @@ -699,7 +701,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): for postfilter_params in postfilter_data: channel = postfilter_params["channel"] with QSignalBlocker(self.params[channel]): - self.params[channel].child("Postfilter Config", "Rate").setValue(postfilter_params["rate"]) + 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"])) def retranslateUi(self, MainWindow): super().retranslateUi(MainWindow)