1
0
forked from M-Labs/kirdy

gui: Add new form for temp adc filter cfg and settable polling rate

List of Changes:
1. Get report via polling instead of active report mode
2. Allow user to set a custom report polling rate while settings polling rate is fixed to 10Hz
- it is necessary for pid autotune to function correctly
3. Add a form for configuring temperature adc filter
4. Use two different timer for polling report and settings to optimize performance

Known Issue:
1. CPU utilization increases with the report polling rate as for each report recv-ed, gui renders and plots one frame of the 4 graphs
This commit is contained in:
linuswck 2024-10-10 17:18:05 +08:00
parent cb2bc505c9
commit bad21806f8
4 changed files with 486 additions and 23 deletions

View File

@ -18,7 +18,7 @@ import os
import argparse
import logging
import asyncio
from driver.kirdy import Kirdy as Kirdy_Driver
from driver.kirdy import FilterConfig, Kirdy as Kirdy_Driver
import qasync
from qasync import asyncClose, asyncSlot
from collections import deque
@ -28,6 +28,7 @@ from typing import Any, Optional, List
from ui.ui_conn_settings_form import Ui_Conn_Settings_Form
from ui.ui_config_pd_mon_form import Ui_Cfg_Pd_Mon_Form
from ui.ui_update_network_settings_form import Ui_Update_Network_Settings_Form
from ui.ui_config_adc_filter_form import Ui_Cfg_Adc_Filter_Form
from dateutil import tz
import math
import socket
@ -79,14 +80,21 @@ class Kirdy(QObject):
def __init__(self, parent, kirdy, _poll_interval):
super().__init__(parent)
self._poll_interval = _poll_interval
self._default_poll_interval = _poll_interval
self._kirdy = kirdy
self._kirdy.set_connected_sig(self.connected_sig)
self.connected_sig.connect(self.start_polling)
self.connected_sig.connect(self.connected_setup)
self._noti_info_box = QtWidgets.QMessageBox()
self._noti_info_box.setIcon(QtWidgets.QMessageBox.Icon.Information)
self._kirdy.set_report_sig(self.report_update_sig)
self._kirdy.set_err_msg_sig(self.cmd_fail_sig)
self._timer = QtCore.QBasicTimer()
self._poll_report_timer = QtCore.QTimer()
self._poll_report_timer.timeout.connect(self.polling_event)
self.poll_settings_timer = QtCore.QTimer()
self.poll_settings_timer.setInterval(100)
self.poll_settings_timer.timeout.connect(self.polling_settings_event)
def connected(self):
return self._kirdy.connected()
@ -98,28 +106,37 @@ class Kirdy(QObject):
self._kirdy.start_session(host=host, port=port)
def end_session(self):
if self._timer.isActive():
self._timer.stop()
if self._poll_report_timer.isActive():
self._poll_report_timer.stop()
asyncio.get_running_loop().create_task(self._kirdy.end_session())
@pyqtSlot(bool)
def connected_setup(self, connected):
if connected:
self._kirdy.task_dispatcher(self._kirdy.device.set_active_report_mode(True))
self._kirdy._report_mode_on = True
def timerEvent(self, event):
@pyqtSlot()
def polling_settings_event(self):
self._kirdy.task_dispatcher(self._kirdy.device.get_settings_summary(sig=self.setting_update_sig))
@pyqtSlot()
def polling_event(self):
success = True
success &= self._kirdy.task_dispatcher(self._kirdy.device.get_status_report(sig=self.report_update_sig))
if not(success):
self._noti_info_box.setWindowTitle("Polling rate is too high")
self._noti_info_box.setText(f"Kirdy cannot handle {1/(self._poll_interval)} Hz polling rate. Reset to default polling rate ({1/self._default_poll_interval} Hz)")
self._noti_info_box.show()
self.set_update_s(self._default_poll_interval)
@pyqtSlot(bool)
def start_polling(self, start):
if start:
if not(self._timer.isActive()):
self._timer.start(int(self._poll_interval*1000), self)
if not(self._poll_report_timer.isActive()):
self._poll_report_timer.setInterval(int(self._poll_interval*1000))
self._poll_report_timer.start()
self.poll_settings_timer.start()
else:
logging.debug("Kirdy Polling Timer has been started already.")
else:
self._timer.stop()
self._poll_report_timer.stop()
self.poll_settings_timer.stop()
@pyqtSlot(float)
def set_update_s(self, interval):
@ -127,9 +144,9 @@ class Kirdy(QObject):
self.update_polling_rate()
def update_polling_rate(self):
if self._timer.isActive():
self._timer.stop()
self.start_polling()
if self._poll_report_timer.isActive():
self._poll_report_timer.stop()
self.start_polling(True)
else:
logging.debug("Attempt to update polling timer when it is stopped")
@ -345,6 +362,38 @@ class ConnSettingsForm(QtWidgets.QDialog, Ui_Conn_Settings_Form):
except (OSError, ValueError):
return None
class ConfigAdcFilterForm(QtWidgets.QDialog, Ui_Cfg_Adc_Filter_Form):
def __init__(self):
super().__init__()
self.setupUi(self)
self.filter_type_cbox.addItems(['Sinc5Sinc1With50hz60HzRejection', 'Sinc5Sinc1', 'Sinc3', 'Sinc3WithFineODR'])
self.fine_filter_sampling_rate_spinbox.setVisible(False)
self.fine_filter_sampling_rate_spinbox.setMinimum(FilterConfig.Sinc3WithFineODR.lower_limit)
self.fine_filter_sampling_rate_spinbox.setMaximum(FilterConfig.Sinc3WithFineODR.upper_limit)
self.filter_type_cbox.currentTextChanged.connect(self.sampling_rate_cbox_config)
@pyqtSlot(str)
def sampling_rate_cbox_config(self, filter_type):
if filter_type == "":
return
if filter_type == "Sinc3WithFineODR":
self.filter_sampling_rate_cbox.setVisible(False)
self.fine_filter_sampling_rate_spinbox.setVisible(True)
else:
self.fine_filter_sampling_rate_spinbox.setVisible(False)
self.filter_sampling_rate_cbox.setVisible(True)
self.filter_sampling_rate_cbox.clear()
self.filter_sampling_rate_cbox.addItems(getattr(FilterConfig, filter_type).get_list_of_settings())
def get_filter_settings(self):
filter_type = self.filter_type_cbox.currentText()
if filter_type == "Sinc3WithFineODR":
return getattr(FilterConfig, filter_type)(self.fine_filter_sampling_rate_spinbox.value())
else:
filter_type_val = getattr(FilterConfig, filter_type)
filter_cfg = getattr(filter_type_val, self.filter_sampling_rate_cbox.currentText().lower())
return filter_cfg
class MainWindow(QtWidgets.QMainWindow):
"""The maximum number of sample points to store."""
DEFAULT_MAX_SAMPLES = 1000
@ -410,13 +459,18 @@ class MainWindow(QtWidgets.QMainWindow):
]},
{'name': 'Default Power On', 'type': 'bool', 'value': False, 'lock': False, 'target': 'thermostat', 'action': 'set_default_pwr_on'},
]},
# TODO Temperature ADC Filter Settings
{'name': 'Temperature Monitor Config', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Upper Limit', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (-273, 300),
'unit': '', 'lock': False, 'target': 'thermostat', 'action': 'set_temp_mon_upper_limit', "compactHeight": False},
{'name': 'Lower Limit', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (-273, 300),
'unit': '', 'lock': False, 'target': 'thermostat', 'action': 'set_temp_mon_lower_limit', "compactHeight": False},
]},
{'name': 'Temperature ADC Filter Settings', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Filter Type', 'type': 'list', 'limits': ['Sinc5Sinc1With50hz60HzRejection', 'Sinc5Sinc1', 'Sinc3', 'Sinc3WithFineODR'], 'readonly': True, "compactHeight": False},
{'name': 'Sampling Rate', 'type': 'float', 'value': 16.67, 'decimals': 4, 'unit': 'Hz', 'readonly': True, "compactHeight": False},
{'name': 'Recorded Sampling Rate', 'type': 'float', 'value': 16.67, 'decimals': 4, 'unit': 'Hz', 'readonly': True, "compactHeight": False},
{'name': 'Configure ADC Filter', 'type': 'action'},
]},
{'name': 'Thermistor Settings','expanded': False, 'type': 'group', 'children': [
{'name': 'T₀', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (-273, 300),
'unit': '', 'lock': False, 'target': 'thermostat', 'action': 'set_sh_t0', "compactHeight": False},
@ -470,6 +524,8 @@ class MainWindow(QtWidgets.QMainWindow):
self.update_net_settings_form = UpdateNetSettingsForm()
self.update_net_settings_form.accepted.connect(self.update_net_settings)
self.cfg_adc_filter_form = ConfigAdcFilterForm()
self.max_samples = self.DEFAULT_MAX_SAMPLES
self.autotuner = PIDAutotune(25)
@ -516,6 +572,7 @@ class MainWindow(QtWidgets.QMainWindow):
]
self._set_param_tree()
self._set_up_pd_mon_form()
self._set_up_adc_filter_form()
self.tec_i_graph.setTitle("TEC Current")
self.tec_temp_graph.setTitle("TEC Temperature")
@ -524,7 +581,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.connect_btn.clicked.connect(self.show_conn_settings_form)
self.kirdy_handler = Kirdy(self, self.kirdy, 1.0)
self.kirdy_handler = Kirdy(self, self.kirdy, 1/20.0)
self.kirdy_handler.setting_update_sig.connect(self.update_ld_ctrl_panel_settings)
self.kirdy_handler.setting_update_sig.connect(self.update_thermostat_ctrl_panel_settings)
@ -616,6 +673,10 @@ class MainWindow(QtWidgets.QMainWindow):
pwr_limit_unit = self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.unit
self.cfg_pd_mon_form.cfg_pwr_limit_reading.setText(f"{siConvert(ld_settings['ld_pwr_limit']['value'], pwr_limit_unit):.4f}")
def update_adc_filter_form_readings(self, filter_type, filter_rate):
self.cfg_adc_filter_form.filter_type_reading_lbl.setText(filter_type)
self.cfg_adc_filter_form.filter_sampling_rate_reading_lbl.setText(str(filter_rate))
def show_conn_settings_form(self):
ip_addr = self.ip_addr.split(".")
self.conn_settings_form.addr_in_0.setText(ip_addr[0])
@ -656,6 +717,12 @@ class MainWindow(QtWidgets.QMainWindow):
self.kirdy.task_dispatcher(self.kirdy.thermostat.clear_alarm())
self.tec_clear_alarm_btn.clicked.connect(tec_clear_alarm)
@pyqtSlot(bool)
def update_polling_rate(_):
self.kirdy_handler.set_update_s(1/self.polling_rate_spinbox.value())
self.kirdy_handler.update_polling_rate()
self.polling_rate_apply_btn.clicked.connect(update_polling_rate)
def _set_up_plot_menu(self):
self.plot_menu = QtWidgets.QMenu()
self.plot_menu.setTitle("Plot Settings")
@ -742,6 +809,13 @@ class MainWindow(QtWidgets.QMainWindow):
self.cfg_pd_mon_form.cfg_dark_current_lbl.setText(pd_dark_current_text.replace(":", f" ({pd_dark_current_unit}):"))
self.cfg_pd_mon_form.cfg_dark_current_spinbox.unit = pd_dark_current_unit
def _set_up_adc_filter_form(self):
@pyqtSlot(bool)
def apply_adc_filter_settings():
filter_cfg = self.cfg_adc_filter_form.get_filter_settings()
self.kirdy.task_dispatcher(self.kirdy.thermostat.config_temp_adc_filter(filter_cfg))
self.cfg_adc_filter_form.apply_btn.clicked.connect(apply_adc_filter_settings)
def _set_param_tree(self):
status = self.ld_status
status.setHeaderHidden(True)
@ -790,7 +864,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.params[3].child('PID Config', 'PID Auto Tune', 'Run').sigActivated.connect(autotune)
@pyqtSlot()
def show_pd_mon_cfg_form(parm):
def show_pd_mon_cfg_form(param):
ld_pwr_limit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').value()
pd_responsitivity = self.params[1].child('Photodiode Monitor Config', 'Responsitivity').value()
pd_dark_current = self.params[1].child('Photodiode Monitor Config', 'Dark Current').value()
@ -802,6 +876,23 @@ class MainWindow(QtWidgets.QMainWindow):
self.cfg_pd_mon_form.show()
self.params[1].child('Photodiode Monitor Config', 'Configure Photodiode Monitor').sigActivated.connect(show_pd_mon_cfg_form)
@asyncSlot()
async def show_adc_filter_cfg_form(param):
settings = await self.kirdy.device.get_settings_summary()
filter_type = settings['thermostat']['temp_adc_settings']['filter_type']
filter_rate = settings['thermostat']['temp_adc_settings'][getattr(getattr(FilterConfig, filter_type), "_odr_type")]
self.cfg_adc_filter_form.filter_type_cbox.setCurrentIndex(self.cfg_adc_filter_form.filter_type_cbox.findText(filter_type))
self.cfg_adc_filter_form.sampling_rate_cbox_config(filter_type)
if filter_type == "Sinc3WithFineODR":
self.cfg_adc_filter_form.fine_filter_sampling_rate_spinbox.setValue(filter_rate)
else:
self.cfg_adc_filter_form.filter_sampling_rate_cbox.setCurrentIndex(self.cfg_adc_filter_form.filter_sampling_rate_cbox.findText(filter_rate))
self.cfg_adc_filter_form.show()
self.params[3].child('Temperature ADC Filter Settings', 'Configure ADC Filter').sigActivated.connect(show_adc_filter_cfg_form)
@pyqtSlot(str)
def cmd_cannot_execute(self, kirdy_msg):
self.info_box.setText(kirdy_msg)
@ -961,7 +1052,11 @@ class MainWindow(QtWidgets.QMainWindow):
self.params[3].child('Output Config', 'Limits', 'Max Heating Current').setValuewithLock(settings["tec_settings"]['max_i_neg']['value'])
self.params[3].child('Output Config', 'Limits', 'Max Voltage Difference').setValuewithLock(settings["tec_settings"]['max_v']['value'])
self.params[3].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"])
# TODO: Update the Temperature ADC Settings here as well
filter_type = settings['temp_adc_settings']['filter_type']
filter_rate = settings['temp_adc_settings'][getattr(getattr(FilterConfig, filter_type), "_odr_type")]
self.update_adc_filter_form_readings(filter_type, filter_rate)
self.params[3].child('Temperature ADC Filter Settings', 'Filter Type').setValue(filter_type)
self.params[3].child('Temperature ADC Filter Settings', 'Sampling Rate').setValue(settings['temp_adc_settings']['rate'])
self.params[3].child('Temperature Monitor Config', 'Upper Limit').setValuewithLock(settings["temp_mon_settings"]['upper_limit'])
self.params[3].child('Temperature Monitor Config', 'Lower Limit').setValuewithLock(settings["temp_mon_settings"]['lower_limit'])
self.params[3].child('PID Config', 'Kp').setValuewithLock(settings["pid_params"]['kp'])
@ -996,6 +1091,9 @@ class MainWindow(QtWidgets.QMainWindow):
else:
self.params[3].child('Readings', 'Temperature').setValuewithLock(report["temperature"])
self.params[3].child('Readings', 'Current through TEC').setValuewithLock(report["tec_i"])
rate = 1 / (report['interval']['ms'] / 1e3 + report['interval']['us'] / 1e6)
self.params[3].child('Temperature ADC Filter Settings', 'Recorded Sampling Rate').setValue(rate)
self.cfg_adc_filter_form.recorded_sampling_rate_reading_lbl.setText(f"{rate:.2f}")
except Exception as e:
logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Cfg_Adc_Filter_Form</class>
<widget class="QDialog" name="Cfg_Adc_Filter_Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>786</width>
<height>303</height>
</rect>
</property>
<property name="windowTitle">
<string>Config Temperature ADC Filter</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>731</width>
<height>251</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,4,4">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Readings</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="filter_type_layout" stretch="3,4,4">
<item>
<widget class="QLabel" name="filter_type_lbl">
<property name="text">
<string>Filter Type</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="filter_type_cbox">
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="filter_type_reading_lbl">
<property name="text">
<string>Sinc5Sinc1With50hz60HzRejection</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="filter_sampling_rate_layout" stretch="3,4,4,4">
<item>
<widget class="QLabel" name="filter_sampling_rate_lbl">
<property name="text">
<string>Filter Sampling Rate</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="filter_sampling_rate_cbox"/>
</item>
<item>
<widget class="QDoubleSpinBox" name="fine_filter_sampling_rate_spinbox">
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>16.670000000000002</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="filter_sampling_rate_reading_lbl">
<property name="text">
<string>F16SPS</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="recorded_sampling_rate_layout" stretch="3,4,4">
<item>
<widget class="QLabel" name="recorded_sampling_rate_lbl">
<property name="text">
<string>Recorded Sampling Rate</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="recorded_sampling_rate_reading_lbl">
<property name="text">
<string>16.67</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="apply_btn_layout" stretch="3,2,3,2">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="apply_btn">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="close_btn">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>close_btn</sender>
<signal>clicked()</signal>
<receiver>Cfg_Adc_Filter_Form</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>677</x>
<y>246</y>
</hint>
<hint type="destinationlabel">
<x>392</x>
<y>151</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -415,6 +415,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="polling_rate_lbl">
<property name="text">
<string>Polling Rate (Hz): </string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="report_group" native="true">
<property name="enabled">
@ -448,9 +455,26 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QDoubleSpinBox" name="polling_rate_spinbox">
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>20.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="polling_rate_apply_btn">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -0,0 +1,131 @@
# Form implementation generated from reading ui file 'config_adc_filter_form.ui'
#
# Created by: PyQt6 UI code generator 6.6.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Cfg_Adc_Filter_Form(object):
def setupUi(self, Cfg_Adc_Filter_Form):
Cfg_Adc_Filter_Form.setObjectName("Cfg_Adc_Filter_Form")
Cfg_Adc_Filter_Form.resize(786, 303)
self.verticalLayoutWidget = QtWidgets.QWidget(parent=Cfg_Adc_Filter_Form)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(20, 20, 731, 251))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.label_4 = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.label_4.setObjectName("label_4")
self.horizontalLayout.addWidget(self.label_4)
self.label_5 = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.label_5.setObjectName("label_5")
self.horizontalLayout.addWidget(self.label_5)
self.horizontalLayout.setStretch(0, 3)
self.horizontalLayout.setStretch(1, 4)
self.horizontalLayout.setStretch(2, 4)
self.verticalLayout.addLayout(self.horizontalLayout)
self.filter_type_layout = QtWidgets.QHBoxLayout()
self.filter_type_layout.setObjectName("filter_type_layout")
self.filter_type_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.filter_type_lbl.setObjectName("filter_type_lbl")
self.filter_type_layout.addWidget(self.filter_type_lbl)
self.filter_type_cbox = QtWidgets.QComboBox(parent=self.verticalLayoutWidget)
self.filter_type_cbox.setEditable(False)
self.filter_type_cbox.setObjectName("filter_type_cbox")
self.filter_type_layout.addWidget(self.filter_type_cbox)
self.filter_type_reading_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.filter_type_reading_lbl.setObjectName("filter_type_reading_lbl")
self.filter_type_layout.addWidget(self.filter_type_reading_lbl)
self.filter_type_layout.setStretch(0, 3)
self.filter_type_layout.setStretch(1, 4)
self.filter_type_layout.setStretch(2, 4)
self.verticalLayout.addLayout(self.filter_type_layout)
self.filter_sampling_rate_layout = QtWidgets.QHBoxLayout()
self.filter_sampling_rate_layout.setObjectName("filter_sampling_rate_layout")
self.filter_sampling_rate_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.filter_sampling_rate_lbl.setObjectName("filter_sampling_rate_lbl")
self.filter_sampling_rate_layout.addWidget(self.filter_sampling_rate_lbl)
self.filter_sampling_rate_cbox = QtWidgets.QComboBox(parent=self.verticalLayoutWidget)
self.filter_sampling_rate_cbox.setObjectName("filter_sampling_rate_cbox")
self.filter_sampling_rate_layout.addWidget(self.filter_sampling_rate_cbox)
self.fine_filter_sampling_rate_spinbox = QtWidgets.QDoubleSpinBox(parent=self.verticalLayoutWidget)
self.fine_filter_sampling_rate_spinbox.setMaximum(1000.0)
self.fine_filter_sampling_rate_spinbox.setProperty("value", 16.67)
self.fine_filter_sampling_rate_spinbox.setObjectName("fine_filter_sampling_rate_spinbox")
self.filter_sampling_rate_layout.addWidget(self.fine_filter_sampling_rate_spinbox)
self.filter_sampling_rate_reading_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.filter_sampling_rate_reading_lbl.setObjectName("filter_sampling_rate_reading_lbl")
self.filter_sampling_rate_layout.addWidget(self.filter_sampling_rate_reading_lbl)
self.filter_sampling_rate_layout.setStretch(0, 3)
self.filter_sampling_rate_layout.setStretch(1, 4)
self.filter_sampling_rate_layout.setStretch(2, 4)
self.filter_sampling_rate_layout.setStretch(3, 4)
self.verticalLayout.addLayout(self.filter_sampling_rate_layout)
self.recorded_sampling_rate_layout = QtWidgets.QHBoxLayout()
self.recorded_sampling_rate_layout.setObjectName("recorded_sampling_rate_layout")
self.recorded_sampling_rate_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.recorded_sampling_rate_lbl.setObjectName("recorded_sampling_rate_lbl")
self.recorded_sampling_rate_layout.addWidget(self.recorded_sampling_rate_lbl)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.recorded_sampling_rate_layout.addItem(spacerItem1)
self.recorded_sampling_rate_reading_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget)
self.recorded_sampling_rate_reading_lbl.setObjectName("recorded_sampling_rate_reading_lbl")
self.recorded_sampling_rate_layout.addWidget(self.recorded_sampling_rate_reading_lbl)
self.recorded_sampling_rate_layout.setStretch(0, 3)
self.recorded_sampling_rate_layout.setStretch(1, 4)
self.recorded_sampling_rate_layout.setStretch(2, 4)
self.verticalLayout.addLayout(self.recorded_sampling_rate_layout)
self.apply_btn_layout = QtWidgets.QHBoxLayout()
self.apply_btn_layout.setObjectName("apply_btn_layout")
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.apply_btn_layout.addItem(spacerItem2)
self.apply_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget)
self.apply_btn.setObjectName("apply_btn")
self.apply_btn_layout.addWidget(self.apply_btn)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.apply_btn_layout.addItem(spacerItem3)
self.close_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget)
self.close_btn.setObjectName("close_btn")
self.apply_btn_layout.addWidget(self.close_btn)
self.apply_btn_layout.setStretch(0, 3)
self.apply_btn_layout.setStretch(1, 2)
self.apply_btn_layout.setStretch(2, 3)
self.apply_btn_layout.setStretch(3, 2)
self.verticalLayout.addLayout(self.apply_btn_layout)
self.retranslateUi(Cfg_Adc_Filter_Form)
self.close_btn.clicked.connect(Cfg_Adc_Filter_Form.accept) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Cfg_Adc_Filter_Form)
def retranslateUi(self, Cfg_Adc_Filter_Form):
_translate = QtCore.QCoreApplication.translate
Cfg_Adc_Filter_Form.setWindowTitle(_translate("Cfg_Adc_Filter_Form", "Config Temperature ADC Filter"))
self.label_4.setText(_translate("Cfg_Adc_Filter_Form", "Value"))
self.label_5.setText(_translate("Cfg_Adc_Filter_Form", "Readings"))
self.filter_type_lbl.setText(_translate("Cfg_Adc_Filter_Form", "Filter Type"))
self.filter_type_reading_lbl.setText(_translate("Cfg_Adc_Filter_Form", "Sinc5Sinc1With50hz60HzRejection"))
self.filter_sampling_rate_lbl.setText(_translate("Cfg_Adc_Filter_Form", "Filter Sampling Rate"))
self.filter_sampling_rate_reading_lbl.setText(_translate("Cfg_Adc_Filter_Form", "F16SPS"))
self.recorded_sampling_rate_lbl.setText(_translate("Cfg_Adc_Filter_Form", "Recorded Sampling Rate"))
self.recorded_sampling_rate_reading_lbl.setText(_translate("Cfg_Adc_Filter_Form", "16.67"))
self.apply_btn.setText(_translate("Cfg_Adc_Filter_Form", "Apply"))
self.close_btn.setText(_translate("Cfg_Adc_Filter_Form", "Close"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Cfg_Adc_Filter_Form = QtWidgets.QDialog()
ui = Ui_Cfg_Adc_Filter_Form()
ui.setupUi(Cfg_Adc_Filter_Form)
Cfg_Adc_Filter_Form.show()
sys.exit(app.exec())