diff --git a/pytec/pytec/gui/model/pid_autotuner.py b/pytec/pytec/gui/model/pid_autotuner.py index 3973dbf..75bd3e9 100644 --- a/pytec/pytec/gui/model/pid_autotuner.py +++ b/pytec/pytec/gui/model/pid_autotuner.py @@ -11,7 +11,6 @@ class PIDAutoTuner(QObject): self._thermostat = thermostat self._thermostat.report_update.connect(self.tick) - self._thermostat.interval_update.connect(self.update_sampling_interval) self.autotuners = [PIDAutotune(25) for _ in range(num_of_channel)] self.target_temp = [20.0 for _ in range(num_of_channel)] @@ -20,10 +19,6 @@ class PIDAutoTuner(QObject): self.lookback = [3.0 for _ in range(num_of_channel)] self.sampling_interval = [1 / 16.67 for _ in range(num_of_channel)] - @pyqtSlot(list) - def update_sampling_interval(self, interval): - self.sampling_interval = interval - def set_params(self, params_name, ch, val): getattr(self, params_name)[ch] = val @@ -50,11 +45,14 @@ class PIDAutoTuner(QObject): @asyncSlot(list) async def tick(self, report): for channel_report in report: + ch = channel_report["channel"] + + self.sampling_interval[ch] = channel_report["interval"] + # TODO: Skip when PID Autotune or emit error message if NTC is not connected if channel_report["temperature"] is None: continue - ch = channel_report["channel"] match self.autotuners[ch].state(): case ( PIDAutotuneState.STATE_READY diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 1480f8a..fc5c7dc 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -20,7 +20,6 @@ class Thermostat(QObject, metaclass=PropertyMeta): pid = Property(list) pwm = Property(list) postfilter = Property(list) - interval = Property(list) report = Property(list) connection_error = pyqtSignal() @@ -78,9 +77,6 @@ class Thermostat(QObject, metaclass=PropertyMeta): self.pwm = await pwm_task if self._poll_for_report: self.report = await report_task - self.interval = [ - self.report[i]["interval"] for i in range(len(self.report)) - ] self.pid = await pid_task self.thermistor = await thermistor_task self.postfilter = await postfilter_task @@ -110,9 +106,6 @@ class Thermostat(QObject, metaclass=PropertyMeta): async def report_mode(self): async for report in self._client.report_mode(): self.report_update.emit(report) - self.interval = [ - self.report[i]["interval"] for i in range(len(self.report)) - ] @asyncSlot() async def end_session(self):