forked from M-Labs/thermostat
Add postfilter config
This commit is contained in:
parent
863352d620
commit
ae6f08247a
|
@ -41,6 +41,10 @@ THERMOSTAT_PARAMETERS = [[
|
|||
'commands': [f's-h {ch} r0 {{value}}']},
|
||||
{'name': 'β', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'commands': [f's-h {ch} b {{value}}']},
|
||||
]},
|
||||
{'name': 'Postfilter Config', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'Rate', 'type': 'float', 'value': 16.67, 'step': 0.01, 'suffix': 'Hz',
|
||||
'commands': [f'postfilter {ch} rate {{value}}']},
|
||||
]},
|
||||
{'name': 'PID Config', 'expanded': False, 'type': 'group', 'children': [
|
||||
{'name': 'Kp', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°C/A', 'commands': [f'pid {ch} kp {{value}}']},
|
||||
{'name': 'Ki', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°C/C', 'commands': [f'pid {ch} ki {{value}}']},
|
||||
|
@ -80,6 +84,7 @@ class ClientWatcher(QObject):
|
|||
report_update = pyqtSignal(list)
|
||||
pid_update = pyqtSignal(list)
|
||||
thermistor_update = pyqtSignal(list)
|
||||
postfilter_update = pyqtSignal(list)
|
||||
|
||||
def __init__(self, parent, client, update_s):
|
||||
self.update_s = update_s
|
||||
|
@ -100,6 +105,7 @@ class ClientWatcher(QObject):
|
|||
self.report_update.emit(await self.client._command("report"))
|
||||
self.pid_update.emit(await self.client.get_pid())
|
||||
self.thermistor_update.emit(await self.client.get_steinhart_hart())
|
||||
self.postfilter_update.emit(await self.client.get_postfilter())
|
||||
|
||||
def start_watching(self):
|
||||
self.watch_task = asyncio.create_task(self.run())
|
||||
|
@ -140,6 +146,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
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.client_watcher.postfilter_update.connect(self.update_postfilter)
|
||||
self.report_apply_btn.clicked.connect(
|
||||
lambda: self.client_watcher.set_update_s(self.report_refresh_spin.value())
|
||||
)
|
||||
|
@ -313,6 +320,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
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"])
|
||||
|
||||
@pyqtSlot(list)
|
||||
def update_postfilter(self, postfilter_data):
|
||||
for postfilter_params in postfilter_data:
|
||||
channel = postfilter_params["channel"]
|
||||
with QSignalBlocker(params[channel]):
|
||||
params[channel].child("Postfilter Config", "Rate").setValue(postfilter_params["rate"])
|
||||
|
||||
|
||||
async def coro_main():
|
||||
args = get_argparser().parse_args()
|
||||
|
|
Loading…
Reference in New Issue