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

View File

@ -266,33 +266,36 @@ class MainWindow(QtWidgets.QMainWindow):
for inner_param, change, data in changes:
if change == "value":
new_value = data
if "thermostat:set_param" in inner_param.opts:
if inner_param.opts.get("param", None) is not None:
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
match inner_param.name(), new_value:
case "Postfilter Rate", None:
thermostat_param = thermostat_param.copy()
thermostat_param["field"] = "off"
new_value = ""
case "Control Method", "Constant Current":
return
case "Control Method", "Temperature PID":
new_value = ""
if inner_param.name() == "Postfilter 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)
inner_param.setOpts(lock=True)
await self.client.set_param(
channel=ch, value=new_value, **thermostat_param
)
inner_param.setOpts(lock=False)
if inner_param.opts.get("pid_autotune", None) is not None:
auto_tuner_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(auto_tuner_param, ch, data)
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)
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:
if activater[1] == "ch":
activater[1] = ch
await self.client.set_param(*activater)
@asyncSlot()
async def pid_auto_tune_request(self, ch=0):