Number of channels generalisation

zotino-tec
atse 2023-10-20 11:03:30 +08:00
parent 8cd1a70f50
commit 7c1293e3d2
1 changed files with 7 additions and 5 deletions

View File

@ -20,6 +20,8 @@ from autotune import PIDAutotune, PIDAutotuneState
# pyuic6 -x tec_qt.ui -o ui_tec_qt.py
from ui_tec_qt import Ui_MainWindow
"""Number of channels provided by the Thermostat"""
NUM_CHANNELS: int = 2
def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ master")
@ -254,7 +256,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
]},
{'name': 'Save to flash', 'type': 'action', 'tip': 'Save config to thermostat, applies on reset'},
{'name': 'Load from flash', 'type': 'action', 'tip': 'Load config from flash'}
] for ch in range(2)]
] for ch in range(NUM_CHANNELS)]
def __init__(self, args):
super().__init__()
@ -287,18 +289,18 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.params = [
Parameter.create(name=f"Thermostat Channel {ch} Parameters", type='group', value=ch, children=self.THERMOSTAT_PARAMETERS[ch])
for ch in range(2)
for ch in range(NUM_CHANNELS)
]
self._set_param_tree()
self.channel_graphs = [
ChannelGraphs(getattr(self, f'ch{ch}_t_graph'), getattr(self, f'ch{ch}_i_graph'))
for ch in range(2)
for ch in range(NUM_CHANNELS)
]
self.autotuners = [
PIDAutotune(25)
for _ in range(2)
for _ in range(NUM_CHANNELS)
]
self.loading_spinner.hide()
@ -813,7 +815,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
@pyqtSlot(list)
def update_pwm(self, pwm_data):
channels_zeroed_limits = [set() for i in range(2)]
channels_zeroed_limits = [set() for i in range(NUM_CHANNELS)]
for pwm_params in pwm_data:
channel = pwm_params["channel"]