Save the entire hw_rev data

Not just fan_pwm_recommended
This commit is contained in:
atse 2023-07-26 17:44:15 +08:00
parent ca7c64c115
commit 998d999b59
1 changed files with 4 additions and 4 deletions

View File

@ -170,7 +170,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.ch1_t_connector = DataConnector(self.ch1_t_plot, max_points=self.DEFAULT_MAX_SAMPLES) self.ch1_t_connector = DataConnector(self.ch1_t_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.ch1_i_connector = DataConnector(self.ch1_i_plot, max_points=self.DEFAULT_MAX_SAMPLES) self.ch1_i_connector = DataConnector(self.ch1_i_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.fan_pwm_recommended = False self.hw_rev_data = None
self.tec_client = Client() self.tec_client = Client()
self.client_watcher = ClientWatcher(self, self.tec_client, self.report_refresh_spin.value()) self.client_watcher = ClientWatcher(self, self.tec_client, self.report_refresh_spin.value())
@ -394,9 +394,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def _status(self, hw_rev_d: dict): def _status(self, hw_rev_d: dict):
logging.debug(hw_rev_d) logging.debug(hw_rev_d)
self.hw_rev_data = hw_rev_d
self.status_lbl.setText(f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}") self.status_lbl.setText(f"Connected to Thermostat v{hw_rev_d['rev']['major']}.{hw_rev_d['rev']['minor']}")
self.fan_group.setEnabled(hw_rev_d["settings"]["fan_available"]) self.fan_group.setEnabled(hw_rev_d["settings"]["fan_available"])
self.fan_pwm_recommended = hw_rev_d["settings"]["fan_pwm_recommended"]
@pyqtSlot(dict) @pyqtSlot(dict)
def fan_update(self, fan_settings: dict): def fan_update(self, fan_settings: dict):
@ -407,7 +407,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
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
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.hw_rev_data["settings"]["fan_pwm_recommended"]:
self._set_fan_pwm_warning() self._set_fan_pwm_warning()
@asyncSlot(int) @asyncSlot(int)
@ -418,7 +418,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
with QSignalBlocker(self.fan_auto_box): with QSignalBlocker(self.fan_auto_box):
self.fan_auto_box.setChecked(False) 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.hw_rev_data["settings"]["fan_pwm_recommended"]:
self._set_fan_pwm_warning() self._set_fan_pwm_warning()
@asyncSlot(int) @asyncSlot(int)