From 5c8ab769f38642a501b165657e629dd177deb1d3 Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 29 Aug 2023 12:59:39 +0800 Subject: [PATCH] Set param mroe --- pytec/tec_qt.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 1347e8c..52d16b4 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -233,8 +233,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): ]}, {'name': 'Limits', 'expanded': False, 'type': 'group', 'children': [ {'name': 'Max Absolute Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 3), 'siPrefix': True, - 'suffix': 'A', 'commands': [f'pwm {ch} max_i_pos {{value}}', f'pwm {ch} max_i_neg {{value}}', - f'pid {ch} output_min -{{value}}', f'pid {ch} output_max {{value}}']}, + 'suffix': 'A', 'param': [('pwm', ch, 'max_i_pos'), ('pid', ch, 'output_min', '-'), ('pwm', ch, 'max_i_neg'), ('pid', ch, 'output_max')]}, {'name': 'Max Absolute Voltage', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 5), 'siPrefix': True, 'suffix': 'V', 'param': [('pwm', ch, 'max_v')]}, ]} @@ -629,7 +628,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): return await asyncio.gather(*[self.client._command(x.format(value=data)) for x in inner_param.opts["commands"]]) if inner_param.opts.get("param", None) is not None: - await asyncio.gather(*[self.client.set_param(*x, data) for x in inner_param.opts["param"]]) + 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}") + else: + await self.client.set_param(*thermostat_param, data) def _set_param_tree(self):