From 9803a2d12b53e7d96827800611b82ba6de3dd96c Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 20 Jul 2023 13:49:23 +0800 Subject: [PATCH] Add pwm update --- pytec/tec_qt.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 7108d3c..e88df6a 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -138,6 +138,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.client_watcher.fan_update.connect(self.fan_update) self.client_watcher.report_update.connect(self.update_report) self.client_watcher.pid_update.connect(self.update_pid) + self.client_watcher.pwm_update.connect(self.update_pwm) self.client_watcher.thermistor_update.connect(self.update_thermistor) self.report_apply_btn.clicked.connect( lambda: self.client_watcher.set_update_s(self.report_refresh_spin.value()) @@ -302,6 +303,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): params[channel].child("Thermistor Config", "R₀").setValue(sh_param["params"]["r0"]) params[channel].child("Thermistor Config", "β").setValue(sh_param["params"]["b"]) + @pyqtSlot(list) + def update_pwm(self, pwm_data): + for pwm_params in pwm_data: + channel = pwm_params["channel"] + with QSignalBlocker(params[channel]): + params[channel].child("Output Config", "Max Voltage").setValue(pwm_params["max_v"]["value"]) + params[channel].child("Output Config", "Max Current").setValue(pwm_params["max_i_pos"]["value"]) + async def coro_main(): args = get_argparser().parse_args()