From f93e76eaa0a5419effacae28e0b81f33584d1936 Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 23 Aug 2024 13:36:46 +0800 Subject: [PATCH] params update concurrently --- pytec/pytec/gui/model/thermostat.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 22d9a94..b90d03b 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -64,16 +64,23 @@ class Thermostat(QObject, metaclass=PropertyMeta): return self.hw_rev async def update_params(self): - self.fan = await self._client.get_fan() - self.pwm = await self._client.get_pwm() + fan_task = asyncio.create_task(self._client.get_fan()) + pwm_task = asyncio.create_task(self._client.get_pwm()) + pid_task = asyncio.create_task(self._client.get_pid()) + report_task = asyncio.create_task(self._client.report()) + thermistor_task = asyncio.create_task(self._client.get_steinhart_hart()) + postfilter_task = asyncio.create_task(self._client.get_postfilter()) + + self.fan = await fan_task + self.pwm = await pwm_task if self._poll_for_report: - self.report = await self._client.report() + self.report = await report_task self.interval = [ self.report[i]["interval"] for i in range(len(self.report)) ] - self.pid = await self._client.get_pid() - self.thermistor = await self._client.get_steinhart_hart() - self.postfilter = await self._client.get_postfilter() + self.pid = await pid_task + self.thermistor = await thermistor_task + self.postfilter = await postfilter_task def connected(self): return self._client.connected()