forked from M-Labs/thermostat
GUI: Refactor send_command
#4
|
@ -25,14 +25,10 @@
|
|||
"Constant Current",
|
||||
"Temperature PID"
|
||||
],
|
||||
"activaters":[
|
||||
null,
|
||||
[
|
||||
"pwm",
|
||||
"ch",
|
||||
"pid"
|
||||
]
|
||||
],
|
||||
"thermostat:set_param":{
|
||||
"topic":"pwm",
|
||||
"field":"pid"
|
||||
},
|
||||
"children":[
|
||||
{
|
||||
"name":"Set Current",
|
||||
|
|
|
@ -273,10 +273,16 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
|
||||
thermostat_param = inner_param.opts["thermostat:set_param"]
|
||||
|
||||
if inner_param.name() == "Postfilter Rate" and new_value is None:
|
||||
# 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 = ""
|
||||
|
||||
inner_param.setOpts(lock=True)
|
||||
await self.client.set_param(
|
||||
|
@ -288,15 +294,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
auto_tuner_param = inner_param.opts["pid_autotune"]
|
||||
self.autotuners.set_params(auto_tuner_param, ch, new_value)
|
||||
|
||||
if "activaters" in inner_param.opts:
|
||||
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):
|
||||
match self.autotuners.get_state(ch):
|
||||
|
|
Loading…
Reference in New Issue