This commit is contained in:
atse 2024-08-27 10:49:06 +08:00
parent 19677c2251
commit 911b4c680f
3 changed files with 2 additions and 6 deletions

View File

@ -39,10 +39,9 @@ class Thermostat(QObject, metaclass=PropertyMeta):
async def start_session(self, host, port): async def start_session(self, host, port):
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING) self.connection_state_changed.emit(ThermostatConnectionState.CONNECTING)
await self._client.connect(host, port) await self._client.connect(host, port)
hw_rev_data = await self.get_hw_rev() await self.get_hw_rev()
self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED) self.connection_state_changed.emit(ThermostatConnectionState.CONNECTED)
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())

View File

@ -138,8 +138,6 @@ class ThermostatCtrlMenu(QtWidgets.QMenu):
) )
with QSignalBlocker(self.fan_auto_box): with QSignalBlocker(self.fan_auto_box):
self.fan_auto_box.setChecked(fan_settings["auto_mode"]) self.fan_auto_box.setChecked(fan_settings["auto_mode"])
if not self.hw_rev_data["settings"]["fan_pwm_recommended"]:
self.set_fan_pwm_warning()
def set_fan_pwm_warning(self): def set_fan_pwm_warning(self):
if self.fan_power_slider.value() != 100: if self.fan_power_slider.value() != 100:

View File

@ -58,7 +58,6 @@ class MainWindow(QtWidgets.QMainWindow):
ui_file_path = importlib.resources.files("pytec.gui.view").joinpath("tec_qt.ui") ui_file_path = importlib.resources.files("pytec.gui.view").joinpath("tec_qt.ui")
uic.loadUi(ui_file_path, self) uic.loadUi(ui_file_path, self)
self.hw_rev_data = None
self.info_box = InfoBox() self.info_box = InfoBox()
self.thermostat = Thermostat(self, self.report_refresh_spin.value()) self.thermostat = Thermostat(self, self.report_refresh_spin.value())
@ -220,7 +219,7 @@ class MainWindow(QtWidgets.QMainWindow):
) )
) )
try: try:
self.hw_rev_data = await self._connecting_task await self._connecting_task
except (OSError, asyncio.CancelledError) as exc: except (OSError, asyncio.CancelledError) as exc:
await self.thermostat.end_session() await self.thermostat.end_session()
if isinstance(exc, asyncio.CancelledError): if isinstance(exc, asyncio.CancelledError):