send_command: Remove "activater"

Interpret commands anomalies directly in send_command instead
This commit is contained in:
atse 2024-08-14 13:15:19 +08:00
parent db9b39c95a
commit d7b088ebe1
2 changed files with 14 additions and 21 deletions

View File

@ -25,14 +25,10 @@
"Constant Current",
"Temperature PID"
],
"activaters":[
null,
[
"pwm",
"ch",
"pid"
]
],
"thermostat:set_param":{
"topic":"pwm",
"field":"pid"
},
"children":[
{
"name":"Set Current",

View File

@ -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:
thermostat_param = thermostat_param.copy()
thermostat_param["field"] = "off"
new_value = ""
# 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):