forked from M-Labs/thermostat
Actually pid_auto_tune_request belongs to ctrl_panel
This commit is contained in:
parent
78b3f8e419
commit
89076b2d13
@ -30,19 +30,6 @@ class PIDAutoTuner(QObject):
|
|||||||
def get_state(self, ch):
|
def get_state(self, ch):
|
||||||
return self.autotuners[ch].state()
|
return self.autotuners[ch].state()
|
||||||
|
|
||||||
@asyncSlot()
|
|
||||||
async def pid_auto_tune_request(self, ch):
|
|
||||||
match self.get_state(ch):
|
|
||||||
case PIDAutotuneState.STATE_OFF | PIDAutotuneState.STATE_FAILED:
|
|
||||||
self.load_params_and_set_ready(ch)
|
|
||||||
|
|
||||||
case (
|
|
||||||
PIDAutotuneState.STATE_READY
|
|
||||||
| PIDAutotuneState.STATE_RELAY_STEP_UP
|
|
||||||
| PIDAutotuneState.STATE_RELAY_STEP_DOWN
|
|
||||||
):
|
|
||||||
await self.stop_pid_from_running(ch)
|
|
||||||
|
|
||||||
def load_params_and_set_ready(self, ch):
|
def load_params_and_set_ready(self, ch):
|
||||||
self.autotuners[ch].setParam(
|
self.autotuners[ch].setParam(
|
||||||
self.target_temp[ch],
|
self.target_temp[ch],
|
||||||
|
@ -94,7 +94,7 @@ class CtrlPanel(QObject):
|
|||||||
)
|
)
|
||||||
self.params[i].child(
|
self.params[i].child(
|
||||||
"PID Config", "PID Auto Tune", "Run"
|
"PID Config", "PID Auto Tune", "Run"
|
||||||
).sigActivated.connect(partial(self.autotuners.pid_auto_tune_request, i))
|
).sigActivated.connect(partial(self.pid_auto_tune_request, i))
|
||||||
|
|
||||||
self.thermostat.pid_update.connect(self.update_pid)
|
self.thermostat.pid_update.connect(self.update_pid)
|
||||||
self.thermostat.report_update.connect(self.update_report)
|
self.thermostat.report_update.connect(self.update_report)
|
||||||
@ -285,6 +285,19 @@ class CtrlPanel(QObject):
|
|||||||
f"Channel {ch} PID Autotune has failed.",
|
f"Channel {ch} PID Autotune has failed.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@asyncSlot()
|
||||||
|
async def pid_auto_tune_request(self, ch):
|
||||||
|
match self.autotuners.get_state(ch):
|
||||||
|
case PIDAutotuneState.STATE_OFF | PIDAutotuneState.STATE_FAILED:
|
||||||
|
self.autotuners.load_params_and_set_ready(ch)
|
||||||
|
|
||||||
|
case (
|
||||||
|
PIDAutotuneState.STATE_READY
|
||||||
|
| PIDAutotuneState.STATE_RELAY_STEP_UP
|
||||||
|
| PIDAutotuneState.STATE_RELAY_STEP_DOWN
|
||||||
|
):
|
||||||
|
await self.autotuners.stop_pid_from_running(ch)
|
||||||
|
|
||||||
@asyncSlot(int)
|
@asyncSlot(int)
|
||||||
async def load_settings(self, ch):
|
async def load_settings(self, ch):
|
||||||
await self.thermostat.load_cfg(ch)
|
await self.thermostat.load_cfg(ch)
|
||||||
|
Loading…
Reference in New Issue
Block a user