forked from M-Labs/thermostat
Compare commits
28 Commits
5574559ac6
...
c9aa0eaab8
Author | SHA1 | Date | |
---|---|---|---|
c9aa0eaab8 | |||
ed6cee4394 | |||
e1bd960900 | |||
aed0c484dd | |||
3fe343435d | |||
eddfc40e07 | |||
3ae89760ab | |||
2f9b95f04b | |||
9926c00494 | |||
fde1e6b3e4 | |||
873f16a675 | |||
85c8c23f2c | |||
ac10859f70 | |||
4bda62ab41 | |||
6df37e31aa | |||
2df4c03c2d | |||
2b9bc020ce | |||
dafde57e23 | |||
6a38f9b5a6 | |||
9af4ffd125 | |||
55a7583867 | |||
19c3c7a8f2 | |||
41abad7aa3 | |||
5c8d9c7cce | |||
278898fad2 | |||
dd83daa5d9 | |||
d57cc9ef2a | |||
be77a6f205 |
@ -42,14 +42,10 @@
|
||||
"Constant Current": "constant_current",
|
||||
"Temperature PID": "temperature_pid"
|
||||
},
|
||||
"activaters": [
|
||||
null,
|
||||
[
|
||||
"pwm",
|
||||
"ch",
|
||||
"pid"
|
||||
]
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pwm",
|
||||
"field": "pid"
|
||||
},
|
||||
"tip": "Select control method of output",
|
||||
"children": [
|
||||
{
|
||||
@ -68,11 +64,10 @@
|
||||
"siPrefix": true,
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pwm",
|
||||
"ch",
|
||||
"i_set"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pwm",
|
||||
"field": "i_set"
|
||||
},
|
||||
"tip": "The set current through TEC",
|
||||
"lock": false
|
||||
},
|
||||
@ -90,11 +85,10 @@
|
||||
"suffix": "°C",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pid",
|
||||
"ch",
|
||||
"target"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pid",
|
||||
"field": "target"
|
||||
},
|
||||
"tip": "The temperature setpoint of the TEC",
|
||||
"lock": false
|
||||
}
|
||||
@ -123,11 +117,10 @@
|
||||
"suffix": "A",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pwm",
|
||||
"ch",
|
||||
"max_i_pos"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pwm",
|
||||
"field": "max_i_pos"
|
||||
},
|
||||
"tip": "The maximum cooling (+ve) current through the output pins",
|
||||
"lock": false
|
||||
},
|
||||
@ -147,11 +140,10 @@
|
||||
2
|
||||
],
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pwm",
|
||||
"ch",
|
||||
"max_i_neg"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pwm",
|
||||
"field": "max_i_neg"
|
||||
},
|
||||
"tip": "The maximum heating (-ve) current through the output pins",
|
||||
"lock": false
|
||||
},
|
||||
@ -169,11 +161,10 @@
|
||||
"suffix": "V",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pwm",
|
||||
"ch",
|
||||
"max_v"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pwm",
|
||||
"field": "max_v"
|
||||
},
|
||||
"tip": "The maximum voltage (in both directions) across the output pins",
|
||||
"lock": false
|
||||
}
|
||||
@ -202,11 +193,10 @@
|
||||
"suffix": "°C",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"s-h",
|
||||
"ch",
|
||||
"t0"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "s-h",
|
||||
"field": "t0"
|
||||
},
|
||||
"tip": "The base temperature",
|
||||
"lock": false
|
||||
},
|
||||
@ -222,11 +212,10 @@
|
||||
"suffix": "Ω",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"s-h",
|
||||
"ch",
|
||||
"r0"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "s-h",
|
||||
"field": "r0"
|
||||
},
|
||||
"tip": "The resistance of the thermistor at base temperature T₀",
|
||||
"lock": false
|
||||
},
|
||||
@ -240,11 +229,10 @@
|
||||
"noUnitEditing": true,
|
||||
"decimals": 4,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"s-h",
|
||||
"ch",
|
||||
"b"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "s-h",
|
||||
"field": "b"
|
||||
},
|
||||
"tip": "The Beta Parameter",
|
||||
"lock": false
|
||||
}
|
||||
@ -261,11 +249,10 @@
|
||||
"title": "50/60 Hz Rejection Filter",
|
||||
"type": "list",
|
||||
"value": 16.67,
|
||||
"param": [
|
||||
"postfilter",
|
||||
"ch",
|
||||
"rate"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "postfilter",
|
||||
"field": "rate"
|
||||
},
|
||||
"limits": {
|
||||
"16.67 SPS": 16.67,
|
||||
"20 SPS": 20.0,
|
||||
@ -291,11 +278,10 @@
|
||||
"type": "float",
|
||||
"step": 0.1,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pid",
|
||||
"ch",
|
||||
"kp"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pid",
|
||||
"field": "kp"
|
||||
},
|
||||
"tip": "Proportional gain",
|
||||
"lock": false
|
||||
},
|
||||
@ -307,11 +293,10 @@
|
||||
"suffix": "Hz",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pid",
|
||||
"ch",
|
||||
"ki"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pid",
|
||||
"field": "ki"
|
||||
},
|
||||
"tip": "Integral gain",
|
||||
"lock": false
|
||||
},
|
||||
@ -323,11 +308,10 @@
|
||||
"suffix": "s",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pid",
|
||||
"ch",
|
||||
"kd"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pid",
|
||||
"field": "kd"
|
||||
},
|
||||
"tip": "Differential gain",
|
||||
"lock": false
|
||||
},
|
||||
@ -353,11 +337,10 @@
|
||||
"suffix": "A",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pid",
|
||||
"ch",
|
||||
"output_min"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pid",
|
||||
"field": "output_min"
|
||||
},
|
||||
"tip": "Minimum PID output",
|
||||
"lock": false
|
||||
},
|
||||
@ -376,11 +359,10 @@
|
||||
"suffix": "A",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"param": [
|
||||
"pid",
|
||||
"ch",
|
||||
"output_max"
|
||||
],
|
||||
"thermostat:set_param": {
|
||||
"topic": "pid",
|
||||
"field": "output_max"
|
||||
},
|
||||
"tip": "Maximum PID output",
|
||||
"lock": false
|
||||
}
|
||||
@ -403,10 +385,7 @@
|
||||
"suffix": "°C",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"pid_autotune": [
|
||||
"target_temp",
|
||||
"ch"
|
||||
],
|
||||
"pid_autotune": "target_temp",
|
||||
"tip": "The target temperature to autotune for"
|
||||
},
|
||||
{
|
||||
@ -425,10 +404,7 @@
|
||||
"suffix": "A",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"pid_autotune": [
|
||||
"test_current",
|
||||
"ch"
|
||||
],
|
||||
"pid_autotune": "test_current",
|
||||
"tip": "The testing current when autotuning"
|
||||
},
|
||||
{
|
||||
@ -441,10 +417,7 @@
|
||||
"suffix": "K",
|
||||
"noUnitEditing": true,
|
||||
"compactHeight": false,
|
||||
"pid_autotune": [
|
||||
"temp_swing",
|
||||
"ch"
|
||||
],
|
||||
"pid_autotune": "temp_swing",
|
||||
"tip": "The temperature swing around the target"
|
||||
},
|
||||
{
|
||||
@ -457,10 +430,7 @@
|
||||
"noUnitEditing": true,
|
||||
"suffix": "s",
|
||||
"compactHeight": false,
|
||||
"pid_autotune": [
|
||||
"lookback",
|
||||
"ch"
|
||||
],
|
||||
"pid_autotune": "lookback",
|
||||
"tip": "Amount of time referenced for tuning"
|
||||
},
|
||||
{
|
||||
|
@ -266,37 +266,32 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
|
||||
for inner_param, change, data in changes:
|
||||
if change == "value":
|
||||
if inner_param.opts.get("param", None) is not None:
|
||||
thermostat_param = inner_param.opts["param"]
|
||||
if thermostat_param[1] == "ch":
|
||||
thermostat_param[1] = ch
|
||||
new_value = data
|
||||
if "thermostat:set_param" in inner_param.opts:
|
||||
thermostat_param = inner_param.opts["thermostat:set_param"]
|
||||
|
||||
if inner_param.name() == "rate" and data is None:
|
||||
set_param_args = (*thermostat_param[:2], "off")
|
||||
else:
|
||||
set_param_args = (*thermostat_param, data)
|
||||
param.child(*param.childPath(inner_param)).setOpts(lock=True)
|
||||
await self.client.set_param(*set_param_args)
|
||||
param.child(*param.childPath(inner_param)).setOpts(lock=False)
|
||||
# Handle thermostat command irregularities
|
||||
match inner_param.name(), new_value:
|
||||
case "rate", None:
|
||||
thermostat_param = thermostat_param.copy()
|
||||
thermostat_param["field"] = "off"
|
||||
new_value = ""
|
||||
case "control_method", "constant_current":
|
||||
thermostat_param = thermostat_param.copy()
|
||||
thermostat_param["field"] = "i_set"
|
||||
new_value = inner_param.child("i_set").value()
|
||||
case "control_method", "temperature_pid":
|
||||
new_value = ""
|
||||
|
||||
if inner_param.opts.get("pid_autotune", None) is not None:
|
||||
autotuner_param = inner_param.opts["pid_autotune"][0]
|
||||
if inner_param.opts["pid_autotune"][1] != "ch":
|
||||
ch = inner_param.opts["pid_autotune"][1]
|
||||
self.autotuners.set_params(autotuner_param, ch, data)
|
||||
|
||||
if inner_param.opts.get("activaters", None) is not None:
|
||||
activater = inner_param.opts["activaters"][
|
||||
inner_param.reverse[0].index(data) # ListParameter.reverse = list of codename values
|
||||
]
|
||||
if activater is not None:
|
||||
if activater[1] == "ch":
|
||||
activater[1] = ch
|
||||
await self.client.set_param(*activater)
|
||||
else:
|
||||
inner_param.setOpts(lock=True)
|
||||
await self.client.set_param(
|
||||
"pwm", ch, "i_set", inner_param.child("i_set").value()
|
||||
channel=ch, value=new_value, **thermostat_param
|
||||
)
|
||||
inner_param.setOpts(lock=False)
|
||||
|
||||
if "pid_autotune" in inner_param.opts:
|
||||
auto_tuner_param = inner_param.opts["pid_autotune"]
|
||||
self.autotuners.set_params(auto_tuner_param, ch, new_value)
|
||||
|
||||
@asyncSlot()
|
||||
async def pid_autotune_request(self, ch=0):
|
||||
|
Loading…
Reference in New Issue
Block a user