forked from M-Labs/thermostat
Remove "activater" option
Interpret commands directly in send_command
This commit is contained in:
parent
0b0bf26244
commit
c754dcfb18
@ -33,14 +33,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": [
|
||||
{
|
||||
|
@ -270,13 +270,20 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
if "thermostat:set_param" in inner_param.opts:
|
||||
thermostat_param = inner_param.opts["thermostat:set_param"]
|
||||
|
||||
if inner_param.opts.get("title", None).endswith(" (mA)"):
|
||||
new_value /= 1000 # Given in mA
|
||||
|
||||
if inner_param.name() == "rate" and new_value == "":
|
||||
# Handle thermostat command irregularities
|
||||
match inner_param.name(), new_value:
|
||||
case "rate", "":
|
||||
thermostat_param = thermostat_param.copy()
|
||||
thermostat_param["field"] = "off"
|
||||
case "control_method", "constant_current":
|
||||
inner_param = inner_param.child("i_set")
|
||||
thermostat_param = inner_param.opts["thermostat:set_param"]
|
||||
new_value = inner_param.value()
|
||||
case "control_method", "temperature_pid":
|
||||
new_value = ""
|
||||
|
||||
if inner_param.opts.get("title", None).endswith(" (mA)"):
|
||||
new_value /= 1000 # Given in mA
|
||||
inner_param.setOpts(lock=True)
|
||||
await self.client.set_param(
|
||||
channel=ch, value=new_value, **thermostat_param
|
||||
@ -287,15 +294,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
autotuner_param = inner_param.opts["pid_autotune"]
|
||||
self.autotuners.set_params(ch=ch, val=new_value, **autotuner_param)
|
||||
|
||||
if "activaters" in inner_param.opts:
|
||||
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)
|
||||
|
||||
@asyncSlot()
|
||||
async def pid_autotune_request(self, ch=0):
|
||||
match self.autotuners.get_state(ch):
|
||||
|
Loading…
Reference in New Issue
Block a user