forked from M-Labs/thermostat
Number of channels generalisation
This commit is contained in:
parent
8cd1a70f50
commit
7c1293e3d2
@ -20,6 +20,8 @@ from autotune import PIDAutotune, PIDAutotuneState
|
|||||||
# pyuic6 -x tec_qt.ui -o ui_tec_qt.py
|
# pyuic6 -x tec_qt.ui -o ui_tec_qt.py
|
||||||
from ui_tec_qt import Ui_MainWindow
|
from ui_tec_qt import Ui_MainWindow
|
||||||
|
|
||||||
|
"""Number of channels provided by the Thermostat"""
|
||||||
|
NUM_CHANNELS: int = 2
|
||||||
|
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ master")
|
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': 'Save to flash', 'type': 'action', 'tip': 'Save config to thermostat, applies on reset'},
|
||||||
{'name': 'Load from flash', 'type': 'action', 'tip': 'Load config from flash'}
|
{'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):
|
def __init__(self, args):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -287,18 +289,18 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
self.params = [
|
self.params = [
|
||||||
Parameter.create(name=f"Thermostat Channel {ch} Parameters", type='group', value=ch, children=self.THERMOSTAT_PARAMETERS[ch])
|
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._set_param_tree()
|
||||||
|
|
||||||
self.channel_graphs = [
|
self.channel_graphs = [
|
||||||
ChannelGraphs(getattr(self, f'ch{ch}_t_graph'), getattr(self, f'ch{ch}_i_graph'))
|
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 = [
|
self.autotuners = [
|
||||||
PIDAutotune(25)
|
PIDAutotune(25)
|
||||||
for _ in range(2)
|
for _ in range(NUM_CHANNELS)
|
||||||
]
|
]
|
||||||
|
|
||||||
self.loading_spinner.hide()
|
self.loading_spinner.hide()
|
||||||
@ -813,7 +815,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
@pyqtSlot(list)
|
@pyqtSlot(list)
|
||||||
def update_pwm(self, pwm_data):
|
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:
|
for pwm_params in pwm_data:
|
||||||
channel = pwm_params["channel"]
|
channel = pwm_params["channel"]
|
||||||
|
Loading…
Reference in New Issue
Block a user