thermostat part 2

This commit is contained in:
atse 2024-07-08 12:13:36 +08:00
parent 2c019b8208
commit 3075a19c95
3 changed files with 6 additions and 9 deletions

View File

@ -4,10 +4,9 @@ from autotune import PIDAutotuneState, PIDAutotune
class PIDAutoTuner(QObject):
def __init__(self, parent, client, thermostat, num_of_channel):
def __init__(self, parent, thermostat, num_of_channel):
super().__init__()
self._client = client
self._thermostat = thermostat
self.autotuners = [PIDAutotune(25) for _ in range(num_of_channel)]
self.target_temp = [20.0 for _ in range(num_of_channel)]

View File

@ -3,6 +3,7 @@ from qasync import asyncSlot
from pytec.gui.model.property import Property, PropertyMeta
import asyncio
import logging
from pytec.aioclient import Client
class Thermostat(QObject, metaclass=PropertyMeta):
@ -17,9 +18,9 @@ class Thermostat(QObject, metaclass=PropertyMeta):
info_box_trigger = pyqtSignal(str, str)
connection_error = pyqtSignal()
def __init__(self, parent, client, update_s):
def __init__(self, parent, update_s):
self._update_s = update_s
self._client = client
self._client = Client()
self._watch_task = None
self._report_mode_task = None
self._poll_for_report = True

View File

@ -8,7 +8,6 @@ from pytec.gui.view.ctrl_panel import CtrlPanel
from pytec.gui.view.info_box import InfoBox
from pytec.gui.model.pid_autotuner import PIDAutoTuner
from pytec.gui.model.thermostat import Thermostat
from pytec.aioclient import Client
import json
from autotune import PIDAutotuneState
from qasync import asyncSlot, asyncClose
@ -69,10 +68,8 @@ class MainWindow(QtWidgets.QMainWindow):
self.hw_rev_data = None
self.info_box = InfoBox()
self.client = Client()
self.thermostat = Thermostat(
self, self.client, self.report_refresh_spin.value()
self, self.report_refresh_spin.value()
)
def handle_connection_error():
@ -85,7 +82,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.thermostat.connection_error.connect(handle_connection_error)
self.autotuners = PIDAutoTuner(self, self.client, self.thermostat, 2)
self.autotuners = PIDAutoTuner(self, self.thermostat, 2)
def get_ctrl_panel_config(args):
with open(args.param_tree, "r") as f: