Postfilter option revamped

zotino-tec
atse 2023-08-29 12:39:32 +08:00
parent 1581aa4027
commit 4df651902a
1 changed files with 9 additions and 4 deletions

View File

@ -246,8 +246,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
{'name': 'B', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'param': [('s-h', ch, 'b')]},
]},
{'name': 'Postfilter Config', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Rate', 'type': 'float', 'value': 16.67, 'step': 0.01, 'suffix': 'Hz',
'param': [('postfilter', ch, 'rate')]},
{'name': 'Postfilter Rate', 'type': 'list', 'value': ('rate', 16.67), 'param': [('postfilter', ch)],
'limits': {'Off': ('off',), '16.67 Hz': ('rate', 16.67), '20 Hz': ('rate', 20.0), '21.25 Hz': ('rate', 21.25), '27 Hz': ('rate', 27.0)}},
]},
{'name': 'PID Config', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Kp', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°C/A', 'param': [('pid', ch, 'kp')]},
@ -630,7 +630,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
if inner_param.opts.get("param", None) is not None:
for thermostat_param in inner_param.opts["param"]:
if len(thermostat_param) == 4: # To tack on prefixes to the data
await self.client.set_param(thermostat_param[0], thermostat_param[1], thermostat_param[2], f"{thermostat_param[3]}{data}")
await self.client.set_param(*thermostat_param[:3], f"{thermostat_param[3]}{data}")
elif inner_param.name() == 'Postfilter Rate':
await self.client.set_param(*thermostat_param, *data)
else:
await self.client.set_param(*thermostat_param, data)
@ -699,7 +701,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
for postfilter_params in postfilter_data:
channel = postfilter_params["channel"]
with QSignalBlocker(self.params[channel]):
self.params[channel].child("Postfilter Config", "Rate").setValue(postfilter_params["rate"])
if postfilter_params["rate"] == None:
self.params[channel].child("Postfilter Config", "Postfilter Rate").setValue(('off',))
else:
self.params[channel].child("Postfilter Config", "Postfilter Rate").setValue(('rate', postfilter_params["rate"]))
def retranslateUi(self, MainWindow):
super().retranslateUi(MainWindow)