forked from M-Labs/thermostat
return hwrev when start_session
This commit is contained in:
parent
17157fd890
commit
9f3591770a
@ -37,7 +37,9 @@ class Thermostat(QObject, metaclass=PropertyMeta):
|
|||||||
|
|
||||||
async def start_session(self, host, port):
|
async def start_session(self, host, port):
|
||||||
await self._client.connect(host, port)
|
await self._client.connect(host, port)
|
||||||
|
hw_rev_data = await self.get_hw_rev()
|
||||||
self.start_watching()
|
self.start_watching()
|
||||||
|
return hw_rev_data
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
self._update_params_task = asyncio.create_task(self.update_params())
|
self._update_params_task = asyncio.create_task(self.update_params())
|
||||||
|
@ -186,9 +186,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.conn_menu.port_set_spin.setEnabled(False)
|
self.conn_menu.port_set_spin.setEnabled(False)
|
||||||
self.connect_btn.setText("Disconnect")
|
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)
|
self._status(self.hw_rev_data)
|
||||||
|
|
||||||
case ThermostatConnectionState.CONNECTING:
|
case ThermostatConnectionState.CONNECTING:
|
||||||
@ -223,7 +220,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
await self.autotuners.stop_pid_from_running(ch)
|
await self.autotuners.stop_pid_from_running(ch)
|
||||||
|
|
||||||
def _status(self, hw_rev_d: dict):
|
def _status(self, hw_rev_d: dict):
|
||||||
logging.debug(hw_rev_d)
|
|
||||||
self.status_lbl.setText(
|
self.status_lbl.setText(
|
||||||
f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}"
|
f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}"
|
||||||
)
|
)
|
||||||
@ -265,7 +261,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await self._connecting_task
|
self.hw_rev_data = await self._connecting_task
|
||||||
except (OSError, asyncio.CancelledError) as exc:
|
except (OSError, asyncio.CancelledError) as exc:
|
||||||
await self.bail()
|
await self.bail()
|
||||||
if isinstance(exc, asyncio.CancelledError):
|
if isinstance(exc, asyncio.CancelledError):
|
||||||
|
Loading…
Reference in New Issue
Block a user