More general activater

zotino-tec
atse 2023-10-20 10:47:08 +08:00
parent d8b1e7e964
commit da794080c6
1 changed files with 7 additions and 6 deletions

View File

@ -212,8 +212,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
{'name': 'Temperature', 'type': 'float', 'suffix': '°C', 'decimals': 6, 'readonly': True},
{'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},
'activater': ('pwm', ch, 'pid'), 'children': [
{'name': 'Control Method', 'type': 'mutex', 'limits': ['Constant Current', 'Temperature PID'],
'activaters': [None, ('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),
@ -671,9 +671,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
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'])
if inner_param.opts.get('activaters', None) is not None:
activater = inner_param.opts['activaters'][inner_param.opts['limits'].index(data)]
if activater is not None:
await self.client.set_param(*activater)
def _set_param_tree(self):
@ -792,7 +793,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
channel = settings["channel"]
self.channel_graphs[channel].plot_append(settings)
with QSignalBlocker(self.params[channel]):
self.params[channel].child("Output Config", "Control Method").setValue(settings["pid_engaged"])
self.params[channel].child("Output Config", "Control Method").setValue("Temperature PID" if settings["pid_engaged"] else "Constant Current")
self.channel_graphs[channel].t_line.setVisible(settings["pid_engaged"])
self.params[channel].child("Output Config", "Control Method", "Set Current").setValue(settings["i_set"] * 1000)
if settings['temperature'] is not None and settings['tec_i'] is not None: