forked from M-Labs/thermostat
No need for list now that params are all singular
This commit is contained in:
parent
470ea9edb3
commit
cb2fa36e68
@ -213,38 +213,38 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
{'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},
|
||||
'param': [('pwm', ch, 'pid')], 'children': [
|
||||
'param': ('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')]},
|
||||
'decimals': 6, 'suffix': 'mA', 'param': ('pwm', ch, 'i_set')},
|
||||
{'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-273, 300),
|
||||
'suffix': '°C', 'param': [('pid', ch, 'target')]},
|
||||
'suffix': '°C', 'param': ('pid', ch, 'target')},
|
||||
]},
|
||||
{'name': 'Limits', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'Max Current', 'type': 'float', 'value': 0, 'step': 100, 'decimals': 6, 'limits': (0, 3000),
|
||||
'suffix': 'mA', 'param': [('pwm', ch, 'max_i_pos')]},
|
||||
'suffix': 'mA', 'param': ('pwm', ch, 'max_i_pos')},
|
||||
{'name': 'Min Current', 'type': 'float', 'value': 0, 'step': 100, 'decimals': 6, 'limits': (-3000, 0),
|
||||
'suffix': 'mA', 'param': [('pwm', ch, 'max_i_neg', '-')]},
|
||||
'suffix': 'mA', 'param': ('pwm', ch, 'max_i_neg', '-')},
|
||||
{'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')},
|
||||
]}
|
||||
]},
|
||||
{'name': 'Thermistor Config', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'T₀', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-100, 100),
|
||||
'suffix': '°C', 'param': [('s-h', ch, 't0')]},
|
||||
'suffix': '°C', 'param': ('s-h', ch, 't0')},
|
||||
{'name': 'R₀', 'type': 'float', 'value': 10000, 'step': 1, 'siPrefix': True, 'suffix': 'Ω',
|
||||
'param': [('s-h', ch, 'r0')]},
|
||||
{'name': 'B', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'decimals': 4, 'param': [('s-h', ch, 'b')]},
|
||||
'param': ('s-h', ch, 'r0')},
|
||||
{'name': 'B', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'decimals': 4, 'param': ('s-h', ch, 'b')},
|
||||
]},
|
||||
{'name': 'Postfilter Config', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'Postfilter Rate', 'type': 'list', 'value': ('rate', 16.67), 'param': [('postfilter', ch)],
|
||||
{'name': 'Postfilter Rate', 'type': 'list', 'value': ('rate', 16.67), 'param': ('postfilter', ch),
|
||||
'limits': {'Off': ('off',), '16.67 Hz': ('rate', 16.67), '20 Hz': ('rate', 20.0), '21.25 Hz': ('rate', 21.25), '27 Hz': ('rate', 27.0)}},
|
||||
]},
|
||||
{'name': 'PID Config', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'Kp', 'type': 'float', 'step': 0.1, 'suffix': '', 'param': [('pid', ch, 'kp')]},
|
||||
{'name': 'Ki', 'type': 'float', 'step': 0.1, 'suffix': 'Hz', 'param': [('pid', ch, 'ki')]},
|
||||
{'name': 'Kd', 'type': 'float', 'step': 0.1, 'suffix': 's', 'param': [('pid', ch, 'kd')]},
|
||||
{'name': 'Max Current Output', 'type': 'float', 'step': 100, 'limits': (-3000, 3000), 'decimals': 6, 'suffix': 'mA', 'param': [('pid', ch, 'output_max')]},
|
||||
{'name': 'Min Current Output', 'type': 'float', 'step': 100, 'limits': (-3000, 3000), 'decimals': 6, 'suffix': 'mA', 'param': [('pid', ch, 'output_min')]},
|
||||
{'name': 'Kp', 'type': 'float', 'step': 0.1, 'suffix': '', 'param': ('pid', ch, 'kp')},
|
||||
{'name': 'Ki', 'type': 'float', 'step': 0.1, 'suffix': 'Hz', 'param': ('pid', ch, 'ki')},
|
||||
{'name': 'Kd', 'type': 'float', 'step': 0.1, 'suffix': 's', 'param': ('pid', ch, 'kd')},
|
||||
{'name': 'Max Current Output', 'type': 'float', 'step': 100, 'limits': (-3000, 3000), 'decimals': 6, 'suffix': 'mA', 'param': ('pid', ch, 'output_max')},
|
||||
{'name': 'Min Current Output', 'type': 'float', 'step': 100, 'limits': (-3000, 3000), 'decimals': 6, 'suffix': 'mA', 'param': ('pid', ch, 'output_min')},
|
||||
{'name': 'PID Auto Tune', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'Target Temperature', 'type': 'float', 'value': 20, 'step': 0.1, 'suffix': '°C'},
|
||||
{'name': 'Test Current', 'type': 'float', 'value': 1000, 'decimals': 6, 'step': 100, 'limits': (-3000, 3000), 'suffix': 'mA'},
|
||||
@ -664,21 +664,22 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if inner_param.opts.get("param", None) is not None:
|
||||
if inner_param.name() == 'Control Method' and not data:
|
||||
return
|
||||
for thermostat_param in inner_param.opts["param"]:
|
||||
if 'Current' in inner_param.name():
|
||||
data /= 1000 # Given in mA
|
||||
if len(thermostat_param) == 4:
|
||||
if thermostat_param[3] == '-':
|
||||
data = -data
|
||||
thermostat_param = thermostat_param[:3]
|
||||
thermostat_param = inner_param.opts["param"]
|
||||
|
||||
if inner_param.name() == 'Postfilter Rate':
|
||||
set_param_args = (*thermostat_param, *data)
|
||||
elif inner_param.name() == 'Control Method':
|
||||
set_param_args = thermostat_param
|
||||
else:
|
||||
set_param_args = (*thermostat_param, data)
|
||||
await self.client.set_param(*set_param_args)
|
||||
if 'Current' in inner_param.name():
|
||||
data /= 1000 # Given in mA
|
||||
if len(thermostat_param) == 4:
|
||||
if thermostat_param[3] == '-':
|
||||
data = -data
|
||||
thermostat_param = thermostat_param[:3]
|
||||
|
||||
if inner_param.name() == 'Postfilter Rate':
|
||||
set_param_args = (*thermostat_param, *data)
|
||||
elif inner_param.name() == 'Control Method':
|
||||
set_param_args = thermostat_param
|
||||
else:
|
||||
set_param_args = (*thermostat_param, data)
|
||||
await self.client.set_param(*set_param_args)
|
||||
|
||||
|
||||
def _set_param_tree(self):
|
||||
|
Loading…
Reference in New Issue
Block a user