hwrev updates

This commit is contained in:
atse 2024-08-27 18:01:27 +08:00
parent dc5460f591
commit 7b662374bc
2 changed files with 4 additions and 7 deletions

View File

@ -39,7 +39,6 @@ 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)
await self.get_hw_rev()
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
self.start_watching()

View File

@ -99,7 +99,6 @@ class MainWindow(QtWidgets.QMainWindow):
self.zero_limits_warning.set_limits_warning
)
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())
)
@ -143,6 +142,10 @@ class MainWindow(QtWidgets.QMainWindow):
self.conn_menu.host_set_line.setEnabled(False)
self.conn_menu.port_set_spin.setEnabled(False)
self.connect_btn.setText("Disconnect")
hw_rev_d = await self.thermostat.get_hw_rev()
self.status_lbl.setText(
f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}"
)
case ThermostatConnectionState.CONNECTING:
self.status_lbl.setText("Connecting...")
@ -175,11 +178,6 @@ class MainWindow(QtWidgets.QMainWindow):
else:
await self.autotuners.stop_pid_from_running(ch)
def _status(self, hw_rev_d: dict):
self.status_lbl.setText(
f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}"
)
@asyncSlot(int)
async def on_report_box_stateChanged(self, enabled):
await self.thermostat.set_report_mode(enabled)