Add pwm update

This commit is contained in:
atse 2023-07-20 13:49:23 +08:00
parent 8291b2052f
commit 9803a2d12b

View File

@ -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()