From 72956e19eebacbaa38b5831fcdb3bc10354efcf5 Mon Sep 17 00:00:00 2001 From: atse Date: Wed, 30 Aug 2023 10:17:39 +0800 Subject: [PATCH] No more _command --- pytec/tec_qt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 5918a65..36e19af 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -225,7 +225,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): {'name': 'Current through TEC', 'type': 'float', 'siPrefix': True, 'suffix': 'A', 'readonly': True}, {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ {'name': 'Control Method', 'type': 'mutex', 'limits': {'Constant Current': False, 'Temperature PID': True}, - 'commands': [f'pwm {ch} pid'], 'children': [ + 'param': [('pwm', ch, 'pid')], 'children': [ {'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (-3, 3), 'siPrefix': True, 'triggerOnShow': True, 'suffix': 'A', 'param': [('pwm', ch, 'i_set')]}, {'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-273, 300), 'siPrefix': True, @@ -623,16 +623,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): async def send_command(self, param, changes): for inner_param, change, data in changes: if change == 'value': - if inner_param.opts.get("commands", None) is not None: + if inner_param.opts.get("param", None) is not None: if inner_param.name() == 'Control Method' and not data: 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: 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[:3], f"{thermostat_param[3]}{data}") elif inner_param.name() == 'Postfilter Rate': await self.client.set_param(*thermostat_param, *data) + elif inner_param.name() == 'Control Method': + await self.client.set_param(*thermostat_param) else: await self.client.set_param(*thermostat_param, data)