From b95b9dcefae9b61efedbe21d5b01e462deeb65a7 Mon Sep 17 00:00:00 2001 From: linuswck Date: Fri, 19 Jul 2024 18:37:52 +0800 Subject: [PATCH] gui: Display -273.15 if thermistor is not detected - if tec_temp == None -> Hide temp_plot graph and display -273.15 on ctrl panel --- pykirdy/kirdy_qt.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index c9cf676..e40f009 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -216,15 +216,21 @@ class Graphs: self._pd_mon_pwr_plot.hide() self.pd_mon_pwr_connector.cb_append_data_point(0.0, ts) - if tec_temp is not None: - self.tec_temp_connector.cb_append_data_point(tec_temp, ts) - if self._temp_setpoint_line.isVisible(): - self.tec_setpoint_connector.cb_append_data_point(self._temp_setpoint_line.value(), ts) - else: - self.tec_setpoint_connector.cb_append_data_point(tec_temp, ts) - if tec_i_measure is not None: - self.tec_i_measure_connector.cb_append_data_point(tec_i_measure, ts) - self.tec_i_target_connector.cb_append_data_point(tec_i_set, ts) + if tec_temp is None: + self._tec_temp_plot.hide() + tec_temp = -273.15 + else: + self._tec_temp_plot.show() + + self.tec_temp_connector.cb_append_data_point(tec_temp, ts) + if self._temp_setpoint_line.isVisible(): + self.tec_setpoint_connector.cb_append_data_point(self._temp_setpoint_line.value(), ts) + else: + self.tec_setpoint_connector.cb_append_data_point(tec_temp, ts) + if tec_i_measure is not None: + self.tec_i_measure_connector.cb_append_data_point(tec_i_measure, ts) + self.tec_i_target_connector.cb_append_data_point(tec_i_set, ts) + except Exception as e: logging.error(f"Graph Value cannot be updated. Data:{report}", exc_info=True) @@ -857,7 +863,10 @@ class MainWindow(QtWidgets.QMainWindow): self.params[2].child('Power').setValue('g' if report['pwr_on'] else 'w') self.params[2].child('Alarm').setValue('r' if report['temp_mon_status']['over_temp_alarm'] else 'w') with QSignalBlocker(self.params[3]): - self.params[3].child('Readings', 'Temperature').setValue(report["temperature"]) + if report["temperature"] == None: + self.params[3].child('Readings', 'Temperature').setValue(-273.15) + else: + self.params[3].child('Readings', 'Temperature').setValue(report["temperature"]) self.params[3].child('Readings', 'Current through TEC').setValue(report["tec_i"]) except Exception as e: logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)