forked from M-Labs/thermostat
Real concurrently
This commit is contained in:
parent
969a7be0cc
commit
db7cdca24c
@ -66,21 +66,32 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
return await self._client.hw_rev()
|
return await self._client.hw_rev()
|
||||||
|
|
||||||
async def update_params(self):
|
async def update_params(self):
|
||||||
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())
|
|
||||||
if self._poll_for_report:
|
if self._poll_for_report:
|
||||||
report_task = asyncio.create_task(self._client.report())
|
(
|
||||||
thermistor_task = asyncio.create_task(self._client.get_steinhart_hart())
|
self.fan,
|
||||||
postfilter_task = asyncio.create_task(self._client.get_postfilter())
|
self.pwm,
|
||||||
|
self.report,
|
||||||
self.fan = await fan_task
|
self.pid,
|
||||||
self.pwm = await pwm_task
|
self.thermistor,
|
||||||
if self._poll_for_report:
|
self.postfilter,
|
||||||
self.report = await report_task
|
) = await asyncio.gather(
|
||||||
self.pid = await pid_task
|
self._client.get_fan(),
|
||||||
self.thermistor = await thermistor_task
|
self._client.get_pwm(),
|
||||||
self.postfilter = await postfilter_task
|
self._client.report(),
|
||||||
|
self._client.get_pid(),
|
||||||
|
self._client.get_steinhart_hart(),
|
||||||
|
self._client.get_postfilter(),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.fan, self.pwm, self.pid, self.thermistor, self.postfilter = (
|
||||||
|
await asyncio.gather(
|
||||||
|
self._client.get_fan(),
|
||||||
|
self._client.get_pwm(),
|
||||||
|
self._client.get_pid(),
|
||||||
|
self._client.get_steinhart_hart(),
|
||||||
|
self._client.get_postfilter(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def connected(self):
|
def connected(self):
|
||||||
return self._client.connected()
|
return self._client.connected()
|
||||||
|
Loading…
Reference in New Issue
Block a user