From f8900d295d854faa69c6a8bee0a989486cdec728 Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 29 Aug 2024 12:12:05 +0800 Subject: [PATCH] Order --- pytec/tec_qt.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 2f9a67b..01992de 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -69,6 +69,12 @@ class MainWindow(QtWidgets.QMainWindow): self.autotuners.autotune_state_changed.connect(self.pid_autotune_handler) # Handlers for disconnections + async def autotune_disconnect(): + for ch in range(self.NUM_CHANNELS): + if self.autotuners.get_state(ch) != PIDAutotuneState.STATE_OFF: + await self.autotuners.stop_pid_from_running(ch) + self.thermostat.disconnect_cb = autotune_disconnect + @pyqtSlot() def handle_connection_error(): self.info_box.display_info_box( @@ -76,12 +82,6 @@ class MainWindow(QtWidgets.QMainWindow): ) self.thermostat.connection_error.connect(handle_connection_error) - async def autotune_disconnect(): - for ch in range(self.NUM_CHANNELS): - if self.autotuners.get_state(ch) != PIDAutotuneState.STATE_OFF: - await self.autotuners.stop_pid_from_running(ch) - self.thermostat.disconnect_cb = autotune_disconnect - # Control Panel def get_ctrl_panel_config(args): with open(args.param_tree, "r", encoding="utf-8") as f: