forked from M-Labs/thermostat
No more _command
This commit is contained in:
parent
a213078c9a
commit
72956e19ee
@ -225,7 +225,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
{'name': 'Current through TEC', 'type': 'float', 'siPrefix': True, 'suffix': 'A', 'readonly': True},
|
{'name': 'Current through TEC', 'type': 'float', 'siPrefix': True, 'suffix': 'A', 'readonly': True},
|
||||||
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
||||||
{'name': 'Control Method', 'type': 'mutex', 'limits': {'Constant Current': False, 'Temperature PID': True},
|
{'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,
|
{'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (-3, 3), 'siPrefix': True, 'triggerOnShow': True,
|
||||||
'suffix': 'A', 'param': [('pwm', ch, 'i_set')]},
|
'suffix': 'A', 'param': [('pwm', ch, 'i_set')]},
|
||||||
{'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-273, 300), 'siPrefix': True,
|
{'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):
|
async def send_command(self, param, changes):
|
||||||
for inner_param, change, data in changes:
|
for inner_param, change, data in changes:
|
||||||
if change == 'value':
|
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:
|
if inner_param.name() == 'Control Method' and not data:
|
||||||
return
|
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"]:
|
for thermostat_param in inner_param.opts["param"]:
|
||||||
if len(thermostat_param) == 4: # To tack on prefixes to the data
|
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}")
|
await self.client.set_param(*thermostat_param[:3], f"{thermostat_param[3]}{data}")
|
||||||
elif inner_param.name() == 'Postfilter Rate':
|
elif inner_param.name() == 'Postfilter Rate':
|
||||||
await self.client.set_param(*thermostat_param, *data)
|
await self.client.set_param(*thermostat_param, *data)
|
||||||
|
elif inner_param.name() == 'Control Method':
|
||||||
|
await self.client.set_param(*thermostat_param)
|
||||||
else:
|
else:
|
||||||
await self.client.set_param(*thermostat_param, data)
|
await self.client.set_param(*thermostat_param, data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user