Also plot iset
This commit is contained in:
atse 2023-08-10 13:28:26 +08:00
parent 2db0936185
commit f189b86e06
1 changed files with 12 additions and 2 deletions

View File

@ -178,8 +178,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.ch0_t_plot = LiveLinePlot() self.ch0_t_plot = LiveLinePlot()
self.ch0_i_plot = LiveLinePlot() self.ch0_i_plot = LiveLinePlot()
self.ch0_iset_plot = LiveLinePlot(pen=pg.mkPen('r'))
self.ch1_t_plot = LiveLinePlot() self.ch1_t_plot = LiveLinePlot()
self.ch1_i_plot = LiveLinePlot() self.ch1_i_plot = LiveLinePlot()
self.ch1_iset_plot = LiveLinePlot(pen=pg.mkPen('r'))
self.ch0_t_line = self.ch0_t_graph.getPlotItem().addLine(label='{value} °C') self.ch0_t_line = self.ch0_t_graph.getPlotItem().addLine(label='{value} °C')
self.ch0_t_line.setVisible(False) self.ch0_t_line.setVisible(False)
@ -190,8 +192,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.ch0_t_connector = DataConnector(self.ch0_t_plot, max_points=self.DEFAULT_MAX_SAMPLES) self.ch0_t_connector = DataConnector(self.ch0_t_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.ch0_i_connector = DataConnector(self.ch0_i_plot, max_points=self.DEFAULT_MAX_SAMPLES) self.ch0_i_connector = DataConnector(self.ch0_i_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.ch0_iset_connector = DataConnector(self.ch0_iset_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.ch1_t_connector = DataConnector(self.ch1_t_plot, max_points=self.DEFAULT_MAX_SAMPLES) self.ch1_t_connector = DataConnector(self.ch1_t_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.ch1_i_connector = DataConnector(self.ch1_i_plot, max_points=self.DEFAULT_MAX_SAMPLES) self.ch1_i_connector = DataConnector(self.ch1_i_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.ch1_iset_connector = DataConnector(self.ch1_iset_plot, max_points=self.DEFAULT_MAX_SAMPLES)
self.hw_rev_data = None self.hw_rev_data = None
@ -456,8 +460,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def set_max_samples(self, samples: int): def set_max_samples(self, samples: int):
self.ch0_t_connector.max_points = samples self.ch0_t_connector.max_points = samples
self.ch0_i_connector.max_points = samples self.ch0_i_connector.max_points = samples
self.ch0_iset_connector.max_points = samples
self.ch1_t_connector.max_points = samples self.ch1_t_connector.max_points = samples
self.ch1_i_connector.max_points = samples self.ch1_i_connector.max_points = samples
self.ch1_iset_connector.max_points = samples
def _set_up_graphs(self): def _set_up_graphs(self):
for graph in self.ch0_t_graph, self.ch0_i_graph, self.ch1_t_graph, self.ch1_i_graph: for graph in self.ch0_t_graph, self.ch0_i_graph, self.ch1_t_graph, self.ch1_i_graph:
@ -482,11 +488,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.ch0_t_graph.addItem(self.ch0_t_plot) self.ch0_t_graph.addItem(self.ch0_t_plot)
self.ch0_i_graph.addItem(self.ch0_i_plot) self.ch0_i_graph.addItem(self.ch0_i_plot)
self.ch0_i_graph.addItem(self.ch0_iset_plot)
self.ch1_t_graph.addItem(self.ch1_t_plot) self.ch1_t_graph.addItem(self.ch1_t_plot)
self.ch1_i_graph.addItem(self.ch1_i_plot) self.ch1_i_graph.addItem(self.ch1_i_plot)
self.ch1_i_graph.addItem(self.ch1_iset_plot)
def clear_graphs(self): def clear_graphs(self):
for connector in self.ch0_t_connector, self.ch0_i_connector, self.ch1_t_connector, self.ch1_i_connector: for connector in self.ch0_t_connector, self.ch0_i_connector, self.ch0_iset_connector, self.ch1_t_connector, self.ch1_i_connector, self.ch1_iset_connector:
connector.clear() connector.clear()
async def _on_connection_changed(self, result): async def _on_connection_changed(self, result):
@ -617,11 +625,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
for channel in range(2): for channel in range(2):
temperature = report[channel]['temperature'] temperature = report[channel]['temperature']
current = report[channel]['tec_i'] current = report[channel]['tec_i']
iset = report[channel]['i_set']
time = report[channel]['time'] time = report[channel]['time']
if temperature is not None and current is not None: if temperature is not None and current is not None and iset is not None:
getattr(self, f'ch{channel}_t_connector').cb_append_data_point(temperature, time) getattr(self, f'ch{channel}_t_connector').cb_append_data_point(temperature, time)
getattr(self, f'ch{channel}_i_connector').cb_append_data_point(current, time) getattr(self, f'ch{channel}_i_connector').cb_append_data_point(current, time)
getattr(self, f'ch{channel}_iset_connector').cb_append_data_point(iset, time)
@asyncSlot(object, object) @asyncSlot(object, object)
async def send_command(self, param, changes): async def send_command(self, param, changes):