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