Compare commits

..

No commits in common. "d7b088ebe14540c2b5930c27e02c66c4d6c80bcb" and "b768d61e39af83428d3a3e1acb80b89b0290bd9a" have entirely different histories.

2 changed files with 119 additions and 86 deletions

View File

@ -25,10 +25,14 @@
"Constant Current", "Constant Current",
"Temperature PID" "Temperature PID"
], ],
"thermostat:set_param":{ "activaters":[
"topic":"pwm", null,
"field":"pid" [
}, "pwm",
"ch",
"pid"
]
],
"children":[ "children":[
{ {
"name":"Set Current", "name":"Set Current",
@ -42,10 +46,11 @@
"triggerOnShow":true, "triggerOnShow":true,
"decimals":6, "decimals":6,
"suffix":"mA", "suffix":"mA",
"thermostat:set_param":{ "param":[
"topic":"pwm", "pwm",
"field":"i_set" "ch",
}, "i_set"
],
"lock":false "lock":false
}, },
{ {
@ -58,10 +63,11 @@
300 300
], ],
"format":"{value:.4f} °C", "format":"{value:.4f} °C",
"thermostat:set_param":{ "param":[
"topic":"pid", "pid",
"field":"target" "ch",
}, "target"
],
"lock":false "lock":false
} }
] ]
@ -82,10 +88,11 @@
2000 2000
], ],
"suffix":"mA", "suffix":"mA",
"thermostat:set_param":{ "param":[
"topic":"pwm", "pwm",
"field":"max_i_pos" "ch",
}, "max_i_pos"
],
"lock":false "lock":false
}, },
{ {
@ -99,10 +106,11 @@
2000 2000
], ],
"suffix":"mA", "suffix":"mA",
"thermostat:set_param":{ "param":[
"topic":"pwm", "pwm",
"field":"max_i_neg" "ch",
}, "max_i_neg"
],
"lock":false "lock":false
}, },
{ {
@ -116,10 +124,11 @@
], ],
"siPrefix":true, "siPrefix":true,
"suffix":"V", "suffix":"V",
"thermostat:set_param":{ "param":[
"topic":"pwm", "pwm",
"field":"max_v" "ch",
}, "max_v"
],
"lock":false "lock":false
} }
] ]
@ -141,10 +150,11 @@
100 100
], ],
"format":"{value:.4f} °C", "format":"{value:.4f} °C",
"thermostat:set_param":{ "param":[
"topic":"s-h", "s-h",
"field":"t0" "ch",
}, "t0"
],
"lock":false "lock":false
}, },
{ {
@ -154,10 +164,11 @@
"step":1, "step":1,
"siPrefix":true, "siPrefix":true,
"suffix":"Ω", "suffix":"Ω",
"thermostat:set_param":{ "param":[
"topic":"s-h", "s-h",
"field":"r0" "ch",
}, "r0"
],
"lock":false "lock":false
}, },
{ {
@ -167,20 +178,22 @@
"step":1, "step":1,
"suffix":"K", "suffix":"K",
"decimals":4, "decimals":4,
"thermostat:set_param":{ "param":[
"topic":"s-h", "s-h",
"field":"b" "ch",
}, "b"
],
"lock":false "lock":false
}, },
{ {
"name":"Postfilter Rate", "name":"Postfilter Rate",
"type":"list", "type":"list",
"value":16.67, "value":16.67,
"thermostat:set_param":{ "param":[
"topic":"postfilter", "postfilter",
"field":"rate" "ch",
}, "rate"
],
"limits":{ "limits":{
"Off":null, "Off":null,
"16.67 Hz":16.67, "16.67 Hz":16.67,
@ -202,10 +215,11 @@
"type":"float", "type":"float",
"step":0.1, "step":0.1,
"suffix":"", "suffix":"",
"thermostat:set_param":{ "param":[
"topic":"pid", "pid",
"field":"kp" "ch",
}, "kp"
],
"lock":false "lock":false
}, },
{ {
@ -213,10 +227,11 @@
"type":"float", "type":"float",
"step":0.1, "step":0.1,
"suffix":"Hz", "suffix":"Hz",
"thermostat:set_param":{ "param":[
"topic":"pid", "pid",
"field":"ki" "ch",
}, "ki"
],
"lock":false "lock":false
}, },
{ {
@ -224,10 +239,11 @@
"type":"float", "type":"float",
"step":0.1, "step":0.1,
"suffix":"s", "suffix":"s",
"thermostat:set_param":{ "param":[
"topic":"pid", "pid",
"field":"kd" "ch",
}, "kd"
],
"lock":false "lock":false
}, },
{ {
@ -245,10 +261,11 @@
], ],
"decimals":6, "decimals":6,
"suffix":"mA", "suffix":"mA",
"thermostat:set_param":{ "param":[
"topic":"pid", "pid",
"field":"output_min" "ch",
}, "output_min"
],
"lock":false "lock":false
}, },
{ {
@ -261,10 +278,11 @@
], ],
"decimals":6, "decimals":6,
"suffix":"mA", "suffix":"mA",
"thermostat:set_param":{ "param":[
"topic":"pid", "pid",
"field":"output_max" "ch",
}, "output_max"
],
"lock":false "lock":false
} }
] ]
@ -280,7 +298,10 @@
"value":20, "value":20,
"step":0.1, "step":0.1,
"format":"{value:.4f} °C", "format":"{value:.4f} °C",
"pid_autotune":"target_temp" "pid_autotune":[
"target_temp",
"ch"
]
}, },
{ {
"name":"Test Current", "name":"Test Current",
@ -293,7 +314,10 @@
2000 2000
], ],
"suffix":"mA", "suffix":"mA",
"pid_autotune":"test_current" "pid_autotune":[
"test_current",
"ch"
]
}, },
{ {
"name":"Temperature Swing", "name":"Temperature Swing",
@ -302,7 +326,10 @@
"step":0.1, "step":0.1,
"prefix":"±", "prefix":"±",
"format":"{value:.4f} °C", "format":"{value:.4f} °C",
"pid_autotune":"temp_swing" "pid_autotune":[
"temp_swing",
"ch"
]
}, },
{ {
"name":"Lookback", "name":"Lookback",
@ -310,7 +337,10 @@
"value":3.0, "value":3.0,
"step":0.1, "step":0.1,
"format":"{value:.4f} s", "format":"{value:.4f} s",
"pid_autotune":"lookback" "pid_autotune":[
"lookback",
"ch"
]
}, },
{ {
"name":"Run", "name":"Run",

View File

@ -266,33 +266,36 @@ class MainWindow(QtWidgets.QMainWindow):
for inner_param, change, data in changes: for inner_param, change, data in changes:
if change == "value": if change == "value":
new_value = data if inner_param.opts.get("param", None) is not None:
if "thermostat:set_param" in inner_param.opts:
if inner_param.opts.get("suffix", None) == "mA": if inner_param.opts.get("suffix", None) == "mA":
new_value /= 1000 # Given in mA data /= 1000 # Given in mA
thermostat_param = inner_param.opts["thermostat:set_param"] thermostat_param = inner_param.opts["param"]
if thermostat_param[1] == "ch":
thermostat_param[1] = ch
# Handle thermostat command irregularities if inner_param.name() == "Postfilter Rate" and data is None:
match inner_param.name(), new_value: set_param_args = (*thermostat_param[:2], "off")
case "Postfilter Rate", None: else:
thermostat_param = thermostat_param.copy() set_param_args = (*thermostat_param, data)
thermostat_param["field"] = "off" param.child(*param.childPath(inner_param)).setOpts(lock=True)
new_value = "" await self.client.set_param(*set_param_args)
case "Control Method", "Constant Current": param.child(*param.childPath(inner_param)).setOpts(lock=False)
return
case "Control Method", "Temperature PID":
new_value = ""
inner_param.setOpts(lock=True) if inner_param.opts.get("pid_autotune", None) is not None:
await self.client.set_param( auto_tuner_param = inner_param.opts["pid_autotune"][0]
channel=ch, value=new_value, **thermostat_param if inner_param.opts["pid_autotune"][1] != "ch":
) ch = inner_param.opts["pid_autotune"][1]
inner_param.setOpts(lock=False) self.autotuners.set_params(auto_tuner_param, ch, data)
if "pid_autotune" in inner_param.opts: if inner_param.opts.get("activaters", None) is not None:
auto_tuner_param = inner_param.opts["pid_autotune"] activater = inner_param.opts["activaters"][
self.autotuners.set_params(auto_tuner_param, ch, new_value) inner_param.opts["limits"].index(data)
]
if activater is not None:
if activater[1] == "ch":
activater[1] = ch
await self.client.set_param(*activater)
@asyncSlot() @asyncSlot()
async def pid_auto_tune_request(self, ch=0): async def pid_auto_tune_request(self, ch=0):