Change low and high voltage parameters

This commit is contained in:
goha92 2025-08-08 17:26:40 +03:00
parent 3876896920
commit 575251d4af
3 changed files with 607 additions and 189 deletions

View File

@ -2345,7 +2345,7 @@
<number>40</number> <number>40</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="cap_polarity_l"> <widget class="QLabel" name="hv_polarity_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
@ -2361,7 +2361,7 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="cap_polarity_BOX"> <widget class="QComboBox" name="hv_polarity_BOX">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -2662,7 +2662,7 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="mode_BOX"> <widget class="QComboBox" name="hv_mode_BOX">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>90</x>
@ -2697,7 +2697,7 @@
</property> </property>
</item> </item>
</widget> </widget>
<widget class="QLabel" name="mode"> <widget class="QLabel" name="hv_mode">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
@ -2751,29 +2751,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="t1m_spinBox"> <widget class="QLabel" name="t1_hv_phase_1_duration_l">
<property name="geometry">
<rect>
<x>390</x>
<y>650</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>30</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>70</number>
</property>
</widget>
<widget class="QLabel" name="t1m_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>330</x> <x>330</x>
@ -2783,35 +2761,13 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>t1, мс/10</string> <string>t1, мс</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="t2m_spinBox"> <widget class="QLabel" name="t2_hv_switch_duration_l">
<property name="geometry">
<rect>
<x>390</x>
<y>680</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>40</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>25</number>
</property>
</widget>
<widget class="QLabel" name="t2m_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>330</x> <x>330</x>
@ -2821,35 +2777,13 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>t2, мс/10</string> <string>t2, мс</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="t3m_spinBox"> <widget class="QLabel" name="t3_hv_phase_2_duration_l">
<property name="geometry">
<rect>
<x>390</x>
<y>710</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
<widget class="QLabel" name="t3m_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>330</x> <x>330</x>
@ -2859,13 +2793,13 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>t3, мс/10</string> <string>t3, мс</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="u1m_spinBox"> <widget class="QSpinBox" name="u1_hv_switching_voltage_spinBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>390</x> <x>390</x>
@ -2881,13 +2815,13 @@
<number>80</number> <number>80</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<number>5</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>50</number> <number>50</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="u1m_l"> <widget class="QLabel" name="u1_hv_switching_voltage_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>330</x> <x>330</x>
@ -2903,7 +2837,7 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="u2m_spinBox"> <widget class="QSpinBox" name="u2_hv_cutoff_voltage_spinBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>390</x> <x>390</x>
@ -2913,19 +2847,19 @@
</rect> </rect>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>80</number>
</property>
<property name="singleStep">
<number>5</number> <number>5</number>
</property> </property>
<property name="value"> <property name="maximum">
<number>50</number> <number>50</number>
</property> </property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>27</number>
</property>
</widget> </widget>
<widget class="QLabel" name="u2m_l"> <widget class="QLabel" name="u2_hv_cutoff_voltage_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>330</x> <x>330</x>
@ -2941,6 +2875,81 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QDoubleSpinBox" name="t1_hv_phase_1_duration_SpinBox">
<property name="geometry">
<rect>
<x>390</x>
<y>650</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>3.000000000000000</double>
</property>
<property name="maximum">
<double>12.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>7.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="t2_hv_switch_duration_SpinBox">
<property name="geometry">
<rect>
<x>390</x>
<y>680</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>3.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="t3_hv_phase_2_duration_SpinBox">
<property name="geometry">
<rect>
<x>390</x>
<y>710</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>6.000000000000000</double>
</property>
</widget>
<zorder>level</zorder> <zorder>level</zorder>
<zorder>High_Tf_spinBox</zorder> <zorder>High_Tf_spinBox</zorder>
<zorder>High_Tt2_spinBox</zorder> <zorder>High_Tt2_spinBox</zorder>
@ -2961,8 +2970,8 @@
<zorder>min_energy_spinBox</zorder> <zorder>min_energy_spinBox</zorder>
<zorder>max_energy_l</zorder> <zorder>max_energy_l</zorder>
<zorder>max_energy_spinBox</zorder> <zorder>max_energy_spinBox</zorder>
<zorder>cap_polarity_l</zorder> <zorder>hv_polarity_l</zorder>
<zorder>cap_polarity_BOX</zorder> <zorder>hv_polarity_BOX</zorder>
<zorder>hv_blind_time_spinBox</zorder> <zorder>hv_blind_time_spinBox</zorder>
<zorder>hv_blind_time_l</zorder> <zorder>hv_blind_time_l</zorder>
<zorder>standby_timer_l</zorder> <zorder>standby_timer_l</zorder>
@ -2976,53 +2985,53 @@
<zorder>picture_3</zorder> <zorder>picture_3</zorder>
<zorder>picture_1</zorder> <zorder>picture_1</zorder>
<zorder>c_level</zorder> <zorder>c_level</zorder>
<zorder>mode_BOX</zorder> <zorder>hv_mode_BOX</zorder>
<zorder>mode</zorder> <zorder>hv_mode</zorder>
<zorder>picture_5</zorder> <zorder>picture_5</zorder>
<zorder>picture_4</zorder> <zorder>picture_4</zorder>
<zorder>t1m_spinBox</zorder> <zorder>t1_hv_phase_1_duration_l</zorder>
<zorder>t1m_l</zorder> <zorder>t2_hv_switch_duration_l</zorder>
<zorder>t2m_spinBox</zorder> <zorder>t3_hv_phase_2_duration_l</zorder>
<zorder>t2m_l</zorder> <zorder>u1_hv_switching_voltage_spinBox</zorder>
<zorder>t3m_spinBox</zorder> <zorder>u1_hv_switching_voltage_l</zorder>
<zorder>t3m_l</zorder> <zorder>u2_hv_cutoff_voltage_spinBox</zorder>
<zorder>u1m_spinBox</zorder> <zorder>u2_hv_cutoff_voltage_l</zorder>
<zorder>u1m_l</zorder> <zorder>t1_hv_phase_1_duration_SpinBox</zorder>
<zorder>u2m_spinBox</zorder> <zorder>t2_hv_switch_duration_SpinBox</zorder>
<zorder>u2m_l</zorder> <zorder>t3_hv_phase_2_duration_SpinBox</zorder>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
<string>НВ стимуляция</string> <string>НВ стимуляция</string>
</attribute> </attribute>
<widget class="QLabel" name="t1_lowW_l"> <widget class="QLabel" name="t1_lv_shock_time_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>340</x> <x>340</x>
<y>60</y> <y>160</y>
<width>61</width> <width>61</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>t1, мс/10</string> <string>t1, мс</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="t2_lowW_l"> <widget class="QLabel" name="t2_lv_relax_time_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>340</x> <x>340</x>
<y>90</y> <y>190</y>
<width>61</width> <width>61</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>t2, мс/10</string> <string>t2, мс</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@ -3032,7 +3041,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>20</y> <y>120</y>
<width>301</width> <width>301</width>
<height>221</height> <height>221</height>
</rect> </rect>
@ -3047,71 +3056,27 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="u_lowW_spinBox"> <widget class="QLabel" name="u_lv_voltage_l">
<property name="geometry">
<rect>
<x>400</x>
<y>30</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
<widget class="QSpinBox" name="t1_lowW_spinBox">
<property name="geometry">
<rect>
<x>400</x>
<y>60</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>25</number>
</property>
</widget>
<widget class="QLabel" name="u_lowW_l">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>330</x> <x>330</x>
<y>30</y> <y>130</y>
<width>71</width> <width>71</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>u, В/10</string> <string>u, В</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="t2_lowW_spinBox"> <widget class="QSpinBox" name="t2_lv_relax_time_spinBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>400</x> <x>400</x>
<y>90</y> <y>190</y>
<width>81</width> <width>81</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -3120,15 +3085,333 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>30</number> <number>20</number>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<number>5</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>15</number> <number>10</number>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="lv_mode_BOX">
<property name="geometry">
<rect>
<x>120</x>
<y>70</y>
<width>151</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
<property name="currentText">
<string>None</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>VOO</string>
</property>
</item>
<item>
<property name="text">
<string>VVI</string>
</property>
</item>
<item>
<property name="text">
<string>BURST</string>
</property>
</item>
</widget>
<widget class="QLabel" name="lv_mode">
<property name="geometry">
<rect>
<x>20</x>
<y>70</y>
<width>61</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Режим</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="lv_polarity_l">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>91</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Полярность</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QComboBox" name="lv_polarity_BOX">
<property name="geometry">
<rect>
<x>120</x>
<y>30</y>
<width>151</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
<property name="currentText">
<string>mono</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>mono</string>
</property>
</item>
<item>
<property name="text">
<string>bipolar</string>
</property>
</item>
</widget>
<widget class="QDoubleSpinBox" name="t1_lv_shock_time_SpinBox">
<property name="geometry">
<rect>
<x>400</x>
<y>160</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>2.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="u_lv_voltage_SpinBox">
<property name="geometry">
<rect>
<x>400</x>
<y>130</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>8.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>3.000000000000000</double>
</property>
</widget>
<widget class="QFrame" name="burst_frame">
<property name="geometry">
<rect>
<x>0</x>
<y>360</y>
<width>491</width>
<height>131</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="burst_mode">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>BURST</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QSpinBox" name="burst_cnt_spinBox">
<property name="geometry">
<rect>
<x>190</x>
<y>30</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>25</number>
</property>
</widget>
<widget class="QLabel" name="burst_cnt_l">
<property name="geometry">
<rect>
<x>0</x>
<y>30</y>
<width>191</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Кол-во импульсов в пачке</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="burst_voltage_l">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>101</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>U импульсов, В</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QDoubleSpinBox" name="burst_voltage_SpinBox">
<property name="geometry">
<rect>
<x>190</x>
<y>60</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>8.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>4.000000000000000</double>
</property>
</widget>
<widget class="QSpinBox" name="burst_period_spinBox">
<property name="geometry">
<rect>
<x>190</x>
<y>90</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>150</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>250</number>
</property>
</widget>
<widget class="QLabel" name="burst_period_l">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>181</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>T следования импульсов, мс</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
</widget> </widget>
</widget> </widget>
<widget class="PlotWidget" name="graph_3"> <widget class="PlotWidget" name="graph_3">

View File

@ -209,6 +209,21 @@ class DataClass:
self.Vs_cnt = 0 # счетчик Vs self.Vs_cnt = 0 # счетчик Vs
self.sub_mode = 0 # текущий подрежим терапии self.sub_mode = 0 # текущий подрежим терапии
self.terapy_now = 0 # текущий режим терапии self.terapy_now = 0 # текущий режим терапии
self.burst_period = 0 # период следования импульсов при НВ стимуляции
self.burst_voltage = 0 # напряжение импульсов при НВ стимуляции
self.burst_cnt = 0 # количество импульсов в пачке при НВ стимуляции
self.lv_relax_time = 0 # время стабилизации после НВ стимуляции
self.lv_shock_time = 0 # время импульса НВ стимуляции
self.hv_polarity = 0 # полярность
self.hv_mode = 0 # режим высоковольтной стимуляции
self.hv_phase_1_duration = 0 # время положительной полуволны
self.hv_switch_duration = 0 # время задержки
self.hv_phase_2_duration = 0 # время отрицательной полуволны
self.hv_switching_voltage = 0 # процент от максимального напряжения для смены полярности
self.hv_cutoff_voltage = 0 # процент от максимального напряжения для окончания стимуляции
self.lv_voltage = 0 # напряжение НВ стимуляции
self.lv_mode = 0 # режим низковольтной стимуляции
self.lv_polarity = 0 # полярность для НВ
def clear_data(self): def clear_data(self):
""" """
@ -347,7 +362,7 @@ class DataClass:
""" """
Парсинг с 23 по 30 байт (передача значений в зависимости от остатка от деления счетчика) Парсинг с 23 по 30 байт (передача значений в зависимости от остатка от деления счетчика)
""" """
if self.counter[self.draw_cnt] % 10 == 0: if self.counter[self.draw_cnt] % 12 == 0:
int1 = (shift_or(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False), int1 = (shift_or(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False), int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 25], "big", signed=False), int.from_bytes(self.data_rx[self.pac_count + 25], "big", signed=False),
@ -361,7 +376,7 @@ class DataClass:
self.ECG_RA_max_threshold[self.draw_cnt] = struct.unpack('f', int1.to_bytes(4, 'big'))[0] self.ECG_RA_max_threshold[self.draw_cnt] = struct.unpack('f', int1.to_bytes(4, 'big'))[0]
self.max_treshold = self.ECG_RA_max_threshold[self.draw_cnt] self.max_treshold = self.ECG_RA_max_threshold[self.draw_cnt]
if self.counter[self.draw_cnt] % 10 == 1: if self.counter[self.draw_cnt] % 12 == 1:
int1 = ( int1 = (
shift_or(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False), shift_or(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False), int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False),
@ -369,7 +384,7 @@ class DataClass:
int.from_bytes(self.data_rx[self.pac_count + 26], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 26], "big", signed=False)))
self.square_coef = struct.unpack('f', int1.to_bytes(4, 'big'))[0] self.square_coef = struct.unpack('f', int1.to_bytes(4, 'big'))[0]
if self.counter[self.draw_cnt] % 10 == 2: if self.counter[self.draw_cnt] % 12 == 2:
self.square_time = ( self.square_time = (
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 29], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 29], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 30], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 30], "big", signed=False)))
@ -377,7 +392,7 @@ class DataClass:
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 27], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 27], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 28], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 28], "big", signed=False)))
if self.counter[self.draw_cnt] % 10 == 3: if self.counter[self.draw_cnt] % 12 == 3:
int1 = int.from_bytes(self.data_rx[self.pac_count + 24], "big") int1 = int.from_bytes(self.data_rx[self.pac_count + 24], "big")
self.sd_card = (int1 & 0x4) >> 2 self.sd_card = (int1 & 0x4) >> 2
self.channel = int1 & 0x3 self.channel = int1 & 0x3
@ -391,7 +406,7 @@ class DataClass:
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 29], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 29], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 30], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 30], "big", signed=False)))
if self.counter[self.draw_cnt] % 10 == 4: if self.counter[self.draw_cnt] % 12 == 4:
self.last_period[self.draw_cnt] = ( self.last_period[self.draw_cnt] = (
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 27], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 27], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 28], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 28], "big", signed=False)))
@ -400,7 +415,7 @@ class DataClass:
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 25], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 25], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 26], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 26], "big", signed=False)))
if self.counter[self.draw_cnt] % 10 == 5: if self.counter[self.draw_cnt] % 12 == 5:
self.Vs_cnt = ( self.Vs_cnt = (
shift_or_24(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False), shift_or_24(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False), int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False),
@ -414,7 +429,7 @@ class DataClass:
int.from_bytes(self.data_rx[self.pac_count + 27], "big", signed=False), int.from_bytes(self.data_rx[self.pac_count + 27], "big", signed=False),
)) ))
if self.counter[self.draw_cnt] % 10 == 6: if self.counter[self.draw_cnt] % 12 == 6:
self.fibr_tres = ( self.fibr_tres = (
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False) int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False)
@ -428,7 +443,7 @@ class DataClass:
int.from_bytes(self.data_rx[self.pac_count + 28], "big", signed=False) int.from_bytes(self.data_rx[self.pac_count + 28], "big", signed=False)
)) ))
if self.counter[self.draw_cnt] % 10 == 7: if self.counter[self.draw_cnt] % 12 == 7:
self.fibr_cnt = int.from_bytes(self.data_rx[self.pac_count + 25], "big") self.fibr_cnt = int.from_bytes(self.data_rx[self.pac_count + 25], "big")
self.tachy_2_cnt = int.from_bytes(self.data_rx[self.pac_count + 26], "big") self.tachy_2_cnt = int.from_bytes(self.data_rx[self.pac_count + 26], "big")
self.tachy_1_cnt = int.from_bytes(self.data_rx[self.pac_count + 27], "big") self.tachy_1_cnt = int.from_bytes(self.data_rx[self.pac_count + 27], "big")
@ -438,7 +453,7 @@ class DataClass:
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False)))
if self.counter[self.draw_cnt] % 10 == 8: if self.counter[self.draw_cnt] % 12 == 8:
self.now_energy = (shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 27], "big", self.now_energy = (shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 27], "big",
signed=False), signed=False),
int.from_bytes(self.data_rx[self.pac_count + 28], "big", int.from_bytes(self.data_rx[self.pac_count + 28], "big",
@ -453,7 +468,7 @@ class DataClass:
self.hv_step_cnt = int1 & 0xF self.hv_step_cnt = int1 & 0xF
self.hv_step_number = (int1 & 0xF0) >> 4 self.hv_step_number = (int1 & 0xF0) >> 4
if self.counter[self.draw_cnt] % 10 == 9: if self.counter[self.draw_cnt] % 12 == 9:
self.hv_blind_time = ( self.hv_blind_time = (
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False), shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 23], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False))) int.from_bytes(self.data_rx[self.pac_count + 24], "big", signed=False)))
@ -470,3 +485,26 @@ class DataClass:
int1 = int.from_bytes(self.data_rx[self.pac_count + 25], "big", signed=False) int1 = int.from_bytes(self.data_rx[self.pac_count + 25], "big", signed=False)
self.redet_bad = int1 & 0xF self.redet_bad = int1 & 0xF
self.redet_num = (int1 & 0xF0) >> 4 self.redet_num = (int1 & 0xF0) >> 4
if self.counter[self.draw_cnt] % 12 == 10:
int1 = int.from_bytes(self.data_rx[self.pac_count + 23], "big")
self.lv_polarity = (int1 & 0xF0) >> 4
self.lv_mode = int1 & 0xF
self.lv_voltage = int.from_bytes(self.data_rx[self.pac_count + 26], "big")
self.lv_shock_time = int.from_bytes(self.data_rx[self.pac_count + 24], "big")
self.lv_relax_time = int.from_bytes(self.data_rx[self.pac_count + 25], "big")
self.burst_cnt = int.from_bytes(self.data_rx[self.pac_count + 27], "big")
self.burst_voltage = int.from_bytes(self.data_rx[self.pac_count + 28], "big")
self.burst_period = (
shift_or_16(int.from_bytes(self.data_rx[self.pac_count + 29], "big", signed=False),
int.from_bytes(self.data_rx[self.pac_count + 30], "big", signed=False)))
if self.counter[self.draw_cnt] % 12 == 11:
int1 = int.from_bytes(self.data_rx[self.pac_count + 23], "big")
self.hv_polarity = (int1 & 0xF0) >> 4
self.hv_mode = int1 & 0xF
self.hv_phase_1_duration = int.from_bytes(self.data_rx[self.pac_count + 24], "big")
self.hv_switch_duration = int.from_bytes(self.data_rx[self.pac_count + 26], "big")
self.hv_phase_2_duration = int.from_bytes(self.data_rx[self.pac_count + 25], "big")
self.hv_switching_voltage = int.from_bytes(self.data_rx[self.pac_count + 27], "big")
self.hv_cutoff_voltage = int.from_bytes(self.data_rx[self.pac_count + 28], "big")

View File

@ -103,17 +103,31 @@ class Ui(QtWidgets.QMainWindow):
self.hv_step_number_spinBox.valueChanged.connect(self.set_hv_step_number_spinBox) self.hv_step_number_spinBox.valueChanged.connect(self.set_hv_step_number_spinBox)
self.min_energy_spinBox.valueChanged.connect(self.set_min_energy_spinBox) self.min_energy_spinBox.valueChanged.connect(self.set_min_energy_spinBox)
self.max_energy_spinBox.valueChanged.connect(self.set_max_energy_spinBox) self.max_energy_spinBox.valueChanged.connect(self.set_max_energy_spinBox)
self.cap_polarity_BOX.editTextChanged.connect(self.set_cap_polarity_BOX) self.hv_polarity_BOX.editTextChanged.connect(self.set_hv_polarity_BOX)
self.hv_blind_time_spinBox.valueChanged.connect(self.set_hv_blind_time_spinBox) self.hv_blind_time_spinBox.valueChanged.connect(self.set_hv_blind_time_spinBox)
self.standby_timer_spinBox.valueChanged.connect(self.set_standby_timer_spinBox) self.standby_timer_spinBox.valueChanged.connect(self.set_standby_timer_spinBox)
self.redet_num_spinBox.valueChanged.connect(self.set_redet_num_spinBox) self.redet_num_spinBox.valueChanged.connect(self.set_redet_num_spinBox)
self.redet_bad_spinBox.valueChanged.connect(self.set_redet_bad_spinBox) self.redet_bad_spinBox.valueChanged.connect(self.set_redet_bad_spinBox)
self.Spi_spot_set_spinBox.valueChanged.connect(self.set_Spi_spot_set_spinBox) self.Spi_spot_set_spinBox.valueChanged.connect(self.set_Spi_spot_set_spinBox)
self.mode_BOX.editTextChanged.connect(self.set_mode_BOX) self.hv_mode_BOX.editTextChanged.connect(self.set_hv_mode_BOX)
self.u1m_l.setVisible(False) self.t1_hv_phase_1_duration_SpinBox.valueChanged.connect(self.set_t1_hv_phase_1_duration_SpinBox)
self.u2m_l.setVisible(False) self.t2_hv_switch_duration_SpinBox.valueChanged.connect(self.set_t2_hv_switch_duration_SpinBox)
self.u1m_spinBox.setVisible(False) self.t3_hv_phase_2_duration_SpinBox.valueChanged.connect(self.set_t3_hv_phase_2_duration_SpinBox)
self.u2m_spinBox.setVisible(False) self.u1_hv_switching_voltage_spinBox.valueChanged.connect(self.set_u1_hv_switching_voltage_spinBox)
self.u2_hv_cutoff_voltage_spinBox.valueChanged.connect(self.set_u2_hv_cutoff_voltage_spinBox)
self.lv_polarity_BOX.editTextChanged.connect(self.set_lv_polarity_BOX)
self.lv_mode_BOX.editTextChanged.connect(self.set_lv_mode_BOX)
self.u_lv_voltage_SpinBox.valueChanged.connect(self.set_u_lv_voltage_SpinBox)
self.t1_lv_shock_time_SpinBox.valueChanged.connect(self.set_t1_lv_shock_time_SpinBox)
self.t2_lv_relax_time_spinBox.valueChanged.connect(self.set_t2_lv_relax_time_spinBox)
self.burst_cnt_spinBox.valueChanged.connect(self.set_burst_cnt_spinBox)
self.burst_voltage_SpinBox.valueChanged.connect(self.set_burst_voltage_SpinBox)
self.burst_period_spinBox.valueChanged.connect(self.set_burst_period_spinBox)
self.u1_hv_switching_voltage_l.setVisible(False)
self.u2_hv_cutoff_voltage_l.setVisible(False)
self.u1_hv_switching_voltage_spinBox.setVisible(False)
self.u2_hv_cutoff_voltage_spinBox.setVisible(False)
self.burst_frame.setVisible(False)
set_up_controls() set_up_controls()
@ -191,6 +205,22 @@ class Ui(QtWidgets.QMainWindow):
self.redet_bad_spinBox.setValue(data_in.redet_bad) self.redet_bad_spinBox.setValue(data_in.redet_bad)
self.Work_Mode_pacemaker.setCurrentIndex(data_in.Work_Mode_pacemaker) self.Work_Mode_pacemaker.setCurrentIndex(data_in.Work_Mode_pacemaker)
self.Spi_spot_set_spinBox.setValue(data_in.spi_pot_set) self.Spi_spot_set_spinBox.setValue(data_in.spi_pot_set)
self.hv_polarity_BOX.setValue(data_in.hv_polarity)
self.hv_mode_BOX.setValue(data_in.hv_mode)
self.t1_hv_phase_1_duration_SpinBox.setValue(data_in.hv_phase_1_duration / 10.0)
self.t3_hv_phase_2_duration_SpinBox.setValue(data_in.hv_phase_2_duration / 10.0)
self.t2_hv_switch_duration_SpinBox.setValue(data_in.hv_switch_duration / 10.0)
self.u1_hv_switching_voltage_spinBox.setValue(data_in.hv_switching_voltage)
self.u2_hv_cutoff_voltage_spinBox.setValue(data_in.hv_cutoff_voltage)
self.lv_polarity_BOX.setValue(data_in.lv_polarity)
self.lv_mode_BOX.setValue(data_in.lv_mode)
self.t1_lv_shock_time_SpinBox().setValue(data_in.lv_shock_time / 10.0)
self.t2_lv_relax_time_spinBox().setValue(data_in.lv_relax_time)
self.u_lv_voltage_SpinBox().setValue(data_in.lv_voltage / 10.0)
self.burst_cnt_spinBox.setValue(data_in.burst_cnt)
self.burst_voltage_SpinBox.setValue(data_in.burst_voltage / 10.0)
self.burst_period.setValue(data_in.burst_period)
def timerEvent(self): def timerEvent(self):
if MODE_COM_PORT: if MODE_COM_PORT:
@ -674,9 +704,9 @@ class Ui(QtWidgets.QMainWindow):
"""Визуализация корзины тахикардии 1ст""" """Визуализация корзины тахикардии 1ст"""
self.progressBar_t1.setMaximum(self.t1_count_spinBox.value()) self.progressBar_t1.setMaximum(self.t1_count_spinBox.value())
def set_cap_polarity_BOX(self): def set_hv_polarity_BOX(self):
"""Выбор полярности""" """Выбор полярности"""
param = self.cap_polarity_BOX.currentIndex() param = int(self.hv_polarity_BOX.currentIndex())
match param: match param:
case 0: case 0:
self.picture_1.setVisible(True) self.picture_1.setVisible(True)
@ -690,23 +720,90 @@ class Ui(QtWidgets.QMainWindow):
self.picture_3.setVisible(True) self.picture_3.setVisible(True)
self.picture_1.setVisible(False) self.picture_1.setVisible(False)
self.picture_2.setVisible(False) self.picture_2.setVisible(False)
my_data.state_packet(self.send_mode, self.serial, 0x30, param, 1, int)
def set_mode_BOX(self): def set_hv_mode_BOX(self):
"""Выбор режима высоковольтной стимуляции""" """Выбор режима высоковольтной стимуляции"""
param = self.mode_BOX.currentIndex() param = int(self.hv_mode_BOX.currentIndex())
match param: match param:
case 0: case 0:
self.picture_4.setVisible(True) self.picture_4.setVisible(True)
self.picture_5.setVisible(False) self.picture_5.setVisible(False)
self.u1m_l.setVisible(False) self.u1_hv_switching_voltage_l.setVisible(False)
self.u2m_l.setVisible(False) self.u2_hv_cutoff_voltage_l.setVisible(False)
self.u1m_spinBox.setVisible(False) self.u1_hv_switching_voltage_spinBox.setVisible(False)
self.u2m_spinBox.setVisible(False) self.u2_hv_cutoff_voltage_spinBox.setVisible(False)
case 1: case 1:
self.picture_5.setVisible(True) self.picture_5.setVisible(True)
self.picture_4.setVisible(False) self.picture_4.setVisible(False)
self.u1m_l.setVisible(True) self.u1_hv_switching_voltage_l.setVisible(True)
self.u2m_l.setVisible(True) self.u2_hv_cutoff_voltage_l.setVisible(True)
self.u1m_spinBox.setVisible(True) self.u1_hv_switching_voltage_spinBox.setVisible(True)
self.u2m_spinBox.setVisible(True) self.u2_hv_cutoff_voltage_spinBox.setVisible(True)
my_data.state_packet(self.send_mode, self.serial, 0x31, param, 1, int)
def set_t1_hv_phase_1_duration_SpinBox(self):
"""Выбор времени положительной полуволны"""
param = int(self.t1_hv_phase_1_duration_SpinBox.value()*10)
my_data.state_packet(self.send_mode, self.serial, 0x32, param, 1, int)
def set_t2_hv_switch_duration_SpinBox(self):
"""Выбор времени задержки"""
param = int(self.t2_hv_switch_duration_SpinBox.value()*10)
my_data.state_packet(self.send_mode, self.serial, 0x34, param, 1, int)
def set_t3_hv_phase_2_duration_SpinBox(self):
"""Выбор времени отрицательной полуволны"""
param = int(self.t3_hv_phase_2_duration_SpinBox.value()*10)
my_data.state_packet(self.send_mode, self.serial, 0x33, param, 1, int)
def set_u1_hv_switching_voltage_spinBox(self):
"""Выбор процента от максимального напряжения для смены полярности"""
param = int(self.u1_hv_switching_voltage_spinBox.value())
my_data.state_packet(self.send_mode, self.serial, 0x35, param, 1, int)
def set_u2_hv_cutoff_voltage_spinBox(self):
"""Выбор процента от максимального напряжения для окончания стимуляции"""
param = int(self.u2_hv_cutoff_voltage_spinBox.value())
my_data.state_packet(self.send_mode, self.serial, 0x36, param, 1, int)
def set_lv_mode_BOX(self):
"""Выбор режима низковольтной стимуляции"""
param = self.lv_mode_BOX.currentIndex()
match param:
case 3:
self.burst_frame.setVisible(True)
case _:
self.burst_frame.setVisible(False)
my_data.state_packet(self.send_mode, self.serial, 0x23, param, 1, int)
def set_lv_polarity_BOX(self):
"""Выбор полярности для НВ"""
param = int(self.lv_polarity_BOX.currentIndex())
my_data.state_packet(self.send_mode, self.serial, 0x22, param, 1, int)
def set_u_lv_voltage_SpinBox(self):
"""Выбор напряжения НВ стимуляции"""
param = int(self.u_lv_voltage_SpinBox.value()*10)
my_data.state_packet(self.send_mode, self.serial, 0x26, param, 1, int)
def set_t1_lv_shock_time_SpinBox(self):
"""Выбор времени импульса НВ стимуляции"""
param = int(self.t1_lv_shock_time_SpinBox.value() * 10)
my_data.state_packet(self.send_mode, self.serial, 0x24, param, 1, int)
def set_t2_lv_relax_time_spinBox(self):
"""Выбор времени стабилизации после НВ стимуляции"""
param = int(self.t2_lv_relax_time_spinBox.value() * 10)
my_data.state_packet(self.send_mode, self.serial, 0x25, param, 1, int)
def set_burst_cnt_spinBox(self):
"""Выбор количества импульсов в пачке при НВ стимуляции"""
param = self.burst_cnt_spinBox.value()
my_data.state_packet(self.send_mode, self.serial, 0x27, param, 1, int)
def set_burst_voltage_SpinBox(self):
"""Выбор напряжения импульсов при НВ стимуляции"""
param = int(self.burst_voltage_SpinBox.value() * 10)
my_data.state_packet(self.send_mode, self.serial, 0x28, param, 1, int)
def set_burst_period_spinBox(self):
"""Выбор периода следования импульсов при НВ стимуляции"""
param = self.burst_period_spinBox.value()
my_data.state_packet(self.send_mode, self.serial, 0x29, param, 2, int)