Add pwm update

This commit is contained in:
atse 2023-07-20 13:49:23 +08:00 committed by Tse Kwok Yan
parent 61d207aa20
commit 7d4069497e
1 changed files with 9 additions and 0 deletions

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