return hwrev when start_session

This commit is contained in:
atse 2024-08-23 16:11:27 +08:00
parent 7668bbf57e
commit a76268a81f
2 changed files with 3 additions and 5 deletions

View File

@ -37,7 +37,9 @@ class Thermostat(QObject, metaclass=PropertyMeta):
async def start_session(self, host, port):
await self._client.connect(host, port)
hw_rev_data = await self.get_hw_rev()
self.start_watching()
return hw_rev_data
async def run(self):
self._update_params_task = asyncio.create_task(self.update_params())

View File

@ -177,9 +177,6 @@ class MainWindow(QtWidgets.QMainWindow):
self.conn_menu.port_set_spin.setEnabled(False)
self.connect_btn.setText("Disconnect")
self.hw_rev_data = await self.thermostat.get_hw_rev()
logging.debug(self.hw_rev_data)
self._status(self.hw_rev_data)
case ThermostatConnectionState.CONNECTING:
@ -214,7 +211,6 @@ class MainWindow(QtWidgets.QMainWindow):
await self.autotuners.stop_pid_from_running(ch)
def _status(self, hw_rev_d: dict):
logging.debug(hw_rev_d)
self.status_lbl.setText(
f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}"
)
@ -255,7 +251,7 @@ class MainWindow(QtWidgets.QMainWindow):
)
)
try:
await self._connecting_task
self.hw_rev_data = await self._connecting_task
except (OSError, asyncio.CancelledError) as exc:
await self.bail()
if isinstance(exc, asyncio.CancelledError):