Set param mroe

This commit is contained in:
atse 2023-08-29 12:59:39 +08:00
parent fe7bc5b7e5
commit 5c8ab769f3

View File

@ -233,8 +233,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
]}, ]},
{'name': 'Limits', 'expanded': False, 'type': 'group', 'children': [ {'name': 'Limits', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Max Absolute Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 3), 'siPrefix': True, {'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}}', 'suffix': 'A', 'param': [('pwm', ch, 'max_i_pos'), ('pid', ch, 'output_min', '-'), ('pwm', ch, 'max_i_neg'), ('pid', ch, 'output_max')]},
f'pid {ch} output_min -{{value}}', f'pid {ch} output_max {{value}}']},
{'name': 'Max Absolute Voltage', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 5), 'siPrefix': True, {'name': 'Max Absolute Voltage', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 5), 'siPrefix': True,
'suffix': 'V', 'param': [('pwm', ch, 'max_v')]}, 'suffix': 'V', 'param': [('pwm', ch, 'max_v')]},
]} ]}
@ -629,7 +628,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
return return
await asyncio.gather(*[self.client._command(x.format(value=data)) for x in inner_param.opts["commands"]]) 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: 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): def _set_param_tree(self):