From d8b1e7e96429537f31be6e1c5497c027be4b7476 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 16 Oct 2023 12:00:16 +0800 Subject: [PATCH] Control Method simplifcation --- pytec/tec_qt.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 63876c8..f824a4a 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -213,7 +213,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): {'name': 'Current through TEC', 'type': 'float', 'suffix': 'mA', 'decimals': 6, 'readonly': True}, {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ {'name': 'Control Method', 'type': 'mutex', 'limits': {'Constant Current': False, 'Temperature PID': True}, - 'param': ('pwm', ch, 'pid'), 'children': [ + 'activater': ('pwm', ch, 'pid'), 'children': [ {'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 100, 'limits': (-3000, 3000), 'triggerOnShow': True, 'decimals': 6, 'suffix': 'mA', 'param': ('pwm', ch, 'i_set')}, {'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-273, 300), @@ -662,19 +662,18 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): for inner_param, change, data in changes: if change == 'value': if inner_param.opts.get("param", None) is not None: - if inner_param.name() == 'Control Method' and not data: - return if 'Current' in inner_param.name(): data /= 1000 # Given in mA thermostat_param = inner_param.opts["param"] 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: set_param_args = (*thermostat_param, data) await self.client.set_param(*set_param_args) + if inner_param.opts.get('activater', None) is not None: + if data: + await self.client.set_param(*inner_param.opts['activater']) def _set_param_tree(self):