Disable auto fan box if adjusted while auto

This commit is contained in:
atse 2023-07-19 14:35:51 +08:00
parent 71076510a2
commit e5b0583a91
1 changed files with 4 additions and 3 deletions

View File

@ -151,7 +151,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
return return
with QSignalBlocker(self.fan_power_slider): with QSignalBlocker(self.fan_power_slider):
self.fan_power_slider.setValue(fan_settings["fan_pwm"] or 100) # 0 = PWM off = full strength self.fan_power_slider.setValue(fan_settings["fan_pwm"] or 100) # 0 = PWM off = full strength
self.fan_power_slider.setEnabled(not fan_settings["auto_mode"])
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.fan_pwm_recommended: if not self.fan_pwm_recommended:
@ -159,8 +158,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
@asyncSlot(int) @asyncSlot(int)
async def fan_set(self, value): async def fan_set(self, value):
if not self.tec_client.is_connected() or self.fan_auto_box.isChecked(): if not self.tec_client.is_connected():
return return
if self.fan_auto_box.isChecked():
with QSignalBlocker(self.fan_auto_box):
self.fan_auto_box.setChecked(False)
await self.tec_client.set_param("fan", value) await self.tec_client.set_param("fan", value)
if not self.fan_pwm_recommended: if not self.fan_pwm_recommended:
self._set_fan_pwm_warning() self._set_fan_pwm_warning()
@ -169,7 +171,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
async def fan_auto_set(self, enabled): async def fan_auto_set(self, enabled):
if not self.tec_client.is_connected(): if not self.tec_client.is_connected():
return return
self.fan_power_slider.setEnabled(not enabled)
if enabled: if enabled:
await self.tec_client.set_param("fan", "auto") await self.tec_client.set_param("fan", "auto")
self.fan_update(await self.tec_client.fan()) self.fan_update(await self.tec_client.fan())