Add choice of divice

This commit is contained in:
SimonovaMI 2025-09-24 14:47:52 +03:00
parent 6fbcb3bc78
commit 181a625243
4 changed files with 68 additions and 10 deletions

View File

@ -72,9 +72,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>680</x> <x>680</x>
<y>30</y> <y>20</y>
<width>851</width> <width>1031</width>
<height>41</height> <height>51</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
@ -85,6 +85,58 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="device_groupBox">
<property name="title">
<string>Выбор устройства</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<widget class="QRadioButton" name="device1_radioButton">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>31</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>1</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="device2_radioButton">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
<widget class="QRadioButton" name="device3_radioButton">
<property name="geometry">
<rect>
<x>50</x>
<y>20</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="Read"> <widget class="QPushButton" name="Read">
<property name="enabled"> <property name="enabled">
@ -277,7 +329,7 @@
</rect> </rect>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="visual"> <widget class="QWidget" name="visual">
<attribute name="title"> <attribute name="title">

View File

@ -1,8 +1,7 @@
"""Режимы работы, переменные, влияющие на работу, которые с некоторой вероятностью будут меняться.""" """Режимы работы, переменные, влияющие на работу, которые с некоторой вероятностью будут меняться."""
DATA_RATE = 200 # скорость передачи данных DATA_RATE = 200 # скорость передачи данных
# mes = "AT+CONA11899AA1670B\r\n" mes1 = "AT+CONA11899AA166E1\r\n" # для связи со стимулятором устройство 1
# mes = "AT+CONA11899AA21438\r\n" # для связи со стимулятором mes2 = "AT+CONA11899AA21438\r\n" # для связи со стимулятором устройство 2
mes = "AT+CONA11899AA166E1\r\n" # для связи со стимулятором mes3 = "AT+CONA11899AA1670B\r\n" # для связи со стимулятором устройство 3

View File

@ -17,7 +17,7 @@ from PyQt5 import QtCore
from pyqtgraph import TextItem from pyqtgraph import TextItem
import pyqtgraph as pg import pyqtgraph as pg
import project.controller as my_data import project.controller as my_data
from project import mes from project import mes1, mes2, mes3
# выбор режима чения из файла или из com-порта # выбор режима чения из файла или из com-порта
MODE_COM_PORT = False MODE_COM_PORT = False
@ -282,7 +282,12 @@ class Ui(QtWidgets.QMainWindow):
self.serial.setPortName(self.Port_ch.currentText()) self.serial.setPortName(self.Port_ch.currentText())
self.serial.open(QIODevice.ReadWrite) self.serial.open(QIODevice.ReadWrite)
self.serial.flush() self.serial.flush()
self.serial.write(mes.encode()) if self.device1_radioButton.isChecked():
self.serial.write(mes1.encode())
if self.device2_radioButton.isChecked():
self.serial.write(mes2.encode())
if self.device3_radioButton.isChecked():
self.serial.write(mes3.encode())
self.on_close() self.on_close()
MODE_COM_PORT = True MODE_COM_PORT = True
self.graph_init() self.graph_init()
@ -598,6 +603,7 @@ class Ui(QtWidgets.QMainWindow):
self.Close_file.setVisible(True) self.Close_file.setVisible(True)
self.Restart.setVisible(True) self.Restart.setVisible(True)
self.horizontalScrollBar.setVisible(False) self.horizontalScrollBar.setVisible(False)
self.device_groupBox.setVisible(True)
else: else:
self.on_stop() self.on_stop()
self.OpenB.setVisible(True) self.OpenB.setVisible(True)
@ -613,6 +619,7 @@ class Ui(QtWidgets.QMainWindow):
self.Close_file.setVisible(False) self.Close_file.setVisible(False)
self.Restart.setVisible(False) self.Restart.setVisible(False)
self.horizontalScrollBar.setVisible(True) self.horizontalScrollBar.setVisible(True)
self.device_groupBox.setVisible(False)
def set_send_mode(self): def set_send_mode(self):
"""Установка режима передачи данных (Bluetooth/433)""" """Установка режима передачи данных (Bluetooth/433)"""

Binary file not shown.