forked from M-Labs/thermostat
Only warn about fan pwm when not at full strength
This commit is contained in:
parent
47dbe95045
commit
54bb740a41
|
@ -75,6 +75,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.fan_power_slider.valueChanged.connect(self.fan_set)
|
||||
self.fan_auto_box.stateChanged.connect(self.fan_auto_set)
|
||||
|
||||
self.fan_pwm_recommended = False
|
||||
|
||||
self.tec_client: Client = None
|
||||
self.client_watcher: ClientWatcher = None
|
||||
|
||||
|
@ -100,18 +102,21 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.fan_pwm_warning.setPixmap(QtGui.QPixmap())
|
||||
self.fan_pwm_warning.setToolTip("")
|
||||
|
||||
def _hw_rev(self, hw_rev_d: dict):
|
||||
logging.debug(hw_rev_d)
|
||||
self.hw_rev_lbl.setText(f"Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}")
|
||||
self.fan_group.setEnabled(hw_rev_d["settings"]["fan_available"])
|
||||
if hw_rev_d["settings"]["fan_pwm_recommended"]:
|
||||
self.fan_pwm_warning.setPixmap(QtGui.QPixmap())
|
||||
self.fan_pwm_warning.setToolTip("")
|
||||
else:
|
||||
def _set_fan_pwm_warning(self):
|
||||
if self.fan_power_slider.value() != 100:
|
||||
pixmapi = getattr(QtWidgets.QStyle.StandardPixmap, "SP_MessageBoxWarning")
|
||||
icon = self.style().standardIcon(pixmapi)
|
||||
self.fan_pwm_warning.setPixmap(icon.pixmap(16, 16))
|
||||
self.fan_pwm_warning.setToolTip("Fan power adjustment not recommended on this hardware revision!")
|
||||
else:
|
||||
self.fan_pwm_warning.setPixmap(QtGui.QPixmap())
|
||||
self.fan_pwm_warning.setToolTip("")
|
||||
|
||||
def _hw_rev(self, hw_rev_d: dict):
|
||||
logging.debug(hw_rev_d)
|
||||
self.hw_rev_lbl.setText(f"Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}")
|
||||
self.fan_group.setEnabled(hw_rev_d["settings"]["fan_available"])
|
||||
self.fan_pwm_recommended = hw_rev_d["settings"]["fan_pwm_recommended"]
|
||||
|
||||
def fan_update(self, fan_settings):
|
||||
logging.debug(fan_settings)
|
||||
|
@ -122,12 +127,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.fan_power_slider.setEnabled(not fan_settings["auto_mode"])
|
||||
with QSignalBlocker(self.fan_auto_box):
|
||||
self.fan_auto_box.setChecked(fan_settings["auto_mode"])
|
||||
if not self.fan_pwm_recommended:
|
||||
self._set_fan_pwm_warning()
|
||||
|
||||
@asyncSlot(int)
|
||||
async def fan_set(self, value):
|
||||
if self.tec_client is None or self.fan_auto_box.isChecked():
|
||||
return
|
||||
await self.tec_client.set_param("fan", value)
|
||||
if not self.fan_pwm_recommended:
|
||||
self._set_fan_pwm_warning()
|
||||
|
||||
@asyncSlot(int)
|
||||
async def fan_auto_set(self, enabled):
|
||||
|
|
Loading…
Reference in New Issue