This commit is contained in:
atse 2024-08-29 12:12:05 +08:00
parent f0772a8072
commit f8900d295d

View File

@ -69,6 +69,12 @@ class MainWindow(QtWidgets.QMainWindow):
self.autotuners.autotune_state_changed.connect(self.pid_autotune_handler) self.autotuners.autotune_state_changed.connect(self.pid_autotune_handler)
# Handlers for disconnections # 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() @pyqtSlot()
def handle_connection_error(): def handle_connection_error():
self.info_box.display_info_box( self.info_box.display_info_box(
@ -76,12 +82,6 @@ class MainWindow(QtWidgets.QMainWindow):
) )
self.thermostat.connection_error.connect(handle_connection_error) 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 # Control Panel
def get_ctrl_panel_config(args): def get_ctrl_panel_config(args):
with open(args.param_tree, "r", encoding="utf-8") as f: with open(args.param_tree, "r", encoding="utf-8") as f: