Fix updating status label for hwrev = None

This commit is contained in:
atse 2024-08-27 10:40:06 +08:00
parent 3283b126b8
commit 5f30f12875
2 changed files with 2 additions and 3 deletions

View File

@ -39,8 +39,8 @@ class Thermostat(QObject, metaclass=PropertyMeta):
async def start_session(self, host, port):
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING)
await self._client.connect(host, port)
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
hw_rev_data = await self.get_hw_rev()
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
self.start_watching()
return hw_rev_data

View File

@ -114,6 +114,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.thermostat.interval_update.connect(
self.autotuners.update_sampling_interval
)
self.thermostat.hw_rev_update.connect(self._status)
self.report_apply_btn.clicked.connect(
lambda: self.thermostat.set_update_s(self.report_refresh_spin.value())
)
@ -163,8 +164,6 @@ class MainWindow(QtWidgets.QMainWindow):
self.conn_menu.port_set_spin.setEnabled(False)
self.connect_btn.setText("Disconnect")
self._status(self.hw_rev_data)
case ThermostatConnectionState.CONNECTING:
self.status_lbl.setText("Connecting...")
self.connect_btn.setText("Stop")