Prechádzať zdrojové kódy

硬件校准和软件校准修改

Franike 7 mesiacov pred
rodič
commit
8a92cee110

+ 140 - 2
controller/bms_hard_ctl.py

@@ -5,15 +5,23 @@
 from widget.bms_hard import Win_Hard
 from utils.globalvar import SD
 from utils.qt import QDateTime
+import decimal
+
 
 class BmsHardControll:
     def __init__(self):
         self._view = Win_Hard()
+        self.i = 0
         self.init()
 
     def init(self):
         self._view.rtc_update_signal.connect(self._rtc_time_update)
-
+        self._view.read_hard_signal.connect(self._read_hard)
+        self._view.exit_hard_signal.connect(self._exit_hard)
+        self._view.pack_vol_cali_signal.connect(self._vol_cali)
+        self._view.cur_cali_signal.connect(self._cur_cali)
+        self._view.cell_vol_one_cali_signal.connect(self._cell_one)
+        self._view.cell_vol_all_cali_signal.connect(self._cell_all)
 
     def _rtc_time_update(self):
         text = QDateTime.currentDateTime().toString("yy MM dd HH mm ss")
@@ -34,4 +42,134 @@ class BmsHardControll:
             data[7] = int(time_str[5])
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
         except:
-            self._view.can_connect_error()
+            self._view.can_connect_error()
+
+    def _read_hard(self):
+        try:
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xFF
+            data[1] = 0xFF
+            data[2] = 0xBB
+            data[6] = self.i
+            self.i = self.i + 1
+            if self.i == 255:
+                self.i = 0
+            data[7] = data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6]
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1801, data)
+            data[0] = 2
+            data[2] = 0
+            data[6] = self.i
+            self.i = self.i + 1
+            if self.i == 255:
+                self.i = 0
+            data[7] = data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6]
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1801, data)
+        except:
+            self._view.can_connect_error()
+
+    def _exit_hard(self):
+        try:
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 3
+            data[1] = 0xFF
+            data[6] = self.i
+            self.i = self.i + 1
+            if self.i == 255:
+                self.i = 0
+            data[7] = data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6]
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1801, data)
+        except:
+            self._view.can_connect_error()
+
+    def _vol_cali(self):
+        try:
+            value = decimal.Decimal(self._view.vol_table.cellWidget(0, 2).text()) * decimal.Decimal(10)
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xB000 & 0xFF
+            data[1] = 0xB000 >> 8
+            data[2] = int(value) & 0xFF
+            data[3] = int(value) >> 8 
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+
+            value = decimal.Decimal(self._view.vol_table.cellWidget(1, 2).text()) * decimal.Decimal(10)
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xB001 & 0xFF
+            data[1] = 0xB001 >> 8
+            data[2] = int(value) & 0xFF
+            data[3] = int(value) >> 8 
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+
+            value = decimal.Decimal(self._view.vol_table.cellWidget(1, 2).text()) * decimal.Decimal(10)
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xB002 & 0xFF
+            data[1] = 0xB002 >> 8
+            data[2] = int(value) & 0xFF
+            data[3] = int(value) >> 8 
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+        except:
+            self._view.can_connect_error()
+
+    def _cur_cali(self):
+        try:
+            value = decimal.Decimal(self._view.qline_cali_fbl.text()) * decimal.Decimal(1000)
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xB003 & 0xFF
+            data[1] = 0xB003 >> 8
+            data[2] = int(value) & 0xFF
+            data[3] = int(value) >> 8
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+
+            value = decimal.Decimal(self._view.qline_cur_offset.text()) * decimal.Decimal(10)
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xB004 & 0xFF
+            data[1] = 0xB004 >> 8
+            data[2] = int(value) & 0xFF
+            data[3] = int(value) >> 8 
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+        except:
+            self._view.can_connect_error()
+
+
+    def _cell_one(self):
+        current_onclick_index = self._view.hard_table.currentRow()
+        try:
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = (0xB111 + current_onclick_index) & 0xFF
+            data[1] = (0xB111 + current_onclick_index) >> 8
+            data[2] = self._view.cb_bmu_index.currentIndex() + 1
+            data[3] = int(self._view.hard_table.item(current_onclick_index, 4).text()) & 0xFF
+            data[4] = int(self._view.hard_table.item(current_onclick_index, 4).text()) >> 8
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+        except:
+            self._view.can_connect_error()
+
+    def _cell_all(self):
+        try:
+            # value = float(self._view.edt_cell.text()) * 1000
+            data = []
+            if len(data) < 8:
+                data += (8 - len(data)) * [0]
+            data[0] = 0xB110 & 0xFF
+            data[1] = 0xB110 >> 8
+            data[2] = self._view.cb_bmu_index.currentIndex() + 1
+            data[3] = int(self._view.edt_cell.text()) & 0xFF
+            data[4] = int(self._view.edt_cell.text()) >> 8
+            msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1803, data)
+        except:
+            self._view.can_connect_error()

+ 50 - 5
controller/bms_home_ctl.py

@@ -19,6 +19,7 @@ from utils.qt import QThread, QColor, Qt, QDateTime, QtGui, QtWidgets, QApplicat
 from utils.hex_bit import a_bit
 from worker.bms_work import BmsReceived
 from ui.own.palette_theme import set_edt_bg
+from ctypes import c_int16
 import csv
 
 
@@ -125,6 +126,8 @@ class BmsHomeControll:
             self.bms_received.to_show_0021_signal.connect(self._inf_0021_signal)
             self.bms_received.to_show_0022_signal.connect(self._inf_0022_signal)
             self.bms_received.to_show_0023_signal.connect(self._inf_0023_signal)
+            self.bms_received.to_show_1802_signal.connect(self._inf_1802_signal)
+            self.bms_received.to_show_1803_signal.connect(self._inf_1803_signal)
             self._view.btn_start.setDisabled(True)
             self._view.btn_stop.setDisabled(False)
         else:
@@ -947,9 +950,9 @@ class BmsHomeControll:
 
             if data[0] < 25:
                 # 单体信息页面
-                self.bms_cell_ctl._view.cell_vol_table.cellWidget(3 * data[1], data[0] + 1).setText(str(data[3] << 8 | data[2]) + " mV")
-                self.bms_cell_ctl._view.cell_vol_table.cellWidget(3 * data[1] + 1, data[0] + 1).setText(str(data[5] << 8 | data[4]) + " mV")   
-                self.bms_cell_ctl._view.cell_vol_table.cellWidget(3 * data[1] + 2, data[0] + 1).setText(str(data[7] << 8 | data[6]) + " mV")   
+                self.bms_cell_ctl._view.cell_vol_table.cellWidget(3 * data[1], data[0]).setText(str(data[3] << 8 | data[2]) + " mV")
+                self.bms_cell_ctl._view.cell_vol_table.cellWidget(3 * data[1] + 1, data[0]).setText(str(data[5] << 8 | data[4]) + " mV")   
+                self.bms_cell_ctl._view.cell_vol_table.cellWidget(3 * data[1] + 2, data[0]).setText(str(data[7] << 8 | data[6]) + " mV")   
                 
                 self.cell_single_volt[3 * data[1]] = data[3] << 8 | data[2]
                 self.cell_single_volt[3 * data[1] + 1] = data[5] << 8 | data[4]
@@ -958,7 +961,7 @@ class BmsHomeControll:
                 self._model.cell_volt = self.cell_single_volt
 
                 # 硬件校准页面
-                if (self.bms_hard_ctl._view.cb_bmu_index.currentIndex() == data[0]):
+                if (self.bms_hard_ctl._view.cb_bmu_index.currentIndex() + 1 == data[0]):
                     self.bms_hard_ctl._view.hard_table.item(3 * data[1], 3).setText(str(data[3] << 8 | data[2]))
                     self.bms_hard_ctl._view.hard_table.item(3 * data[1] + 1, 3).setText(str(data[5] << 8 | data[4]))
                     self.bms_hard_ctl._view.hard_table.item(3 * data[1] + 2, 3).setText(str(data[7] << 8 | data[6]))
@@ -1393,6 +1396,48 @@ class BmsHomeControll:
                 with open(SD.RECORD_NAME, 'a') as csvfile:
                     writer = csv.writer(csvfile, dialect='excel', lineterminator='\n')
                     writer.writerow(record_data)
-    
+
+    def _inf_1802_signal(self, data, id):
+        if id == SD.BCU_ID:
+            addr_index = ((data[1] << 8) | data[0])- 0xA000
+            self.bms_protect_ctl._view.end_timer()
+            try:
+                item = QtWidgets.QTableWidgetItem(str((data[3] << 8) | data[2]))
+                item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+                self.bms_protect_ctl._view.protect_table.setItem(addr_index, 8, item)
+
+                real_value = ((data[3] << 8) | data[2]) * float(self.bms_protect_ctl._view.protect_table.item(addr_index, 6).text()) + float(self.bms_protect_ctl._view.protect_table.item(addr_index, 7).text())
+                # print(str(((data[3] << 8) | data[2]) * float(self.bms_protect_ctl._view.protect_table.item(addr_index, 6).text()) + float(self.bms_protect_ctl._view.protect_table.item(addr_index, 7).text())))
+                item = QtWidgets.QTableWidgetItem(str(round(real_value,1)))
+                item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+                self.bms_protect_ctl._view.protect_table.setItem(addr_index, 1, item)
+            except:
+                return
+            
+    def _inf_1803_signal(self, data, id):
+        if id == SD.BCU_ID:
+            addr_index = ((data[1] << 8) | data[0]) - 0xB000
+            # self.bms_protect_ctl._view.end_timer()
+            if addr_index <=4:
+                if addr_index <=2:
+                    self.bms_hard_ctl._view.vol_table.cellWidget(addr_index, 2).setText(str(round(float(c_int16(data[3] << 8 | data[2]).value * 0.1), 1)))
+                elif addr_index == 3:
+                    self.bms_hard_ctl._view.qline_cali_fbl.setText(str(round(float(c_int16(data[3] << 8 | data[2]).value * 0.001), 3)))
+                else:
+                    self.bms_hard_ctl._view.qline_cur_offset.setText(str(round(float(c_int16(data[3] << 8 | data[2]).value * 0.1), 1))) 
+            else:
+                cell_vol_index = ((data[1] << 8) | data[0]) - 0xB110
+                if cell_vol_index:
+                    try:
+                        if self.bms_hard_ctl._view.cb_bmu_index.currentIndex() + 1 == data[2]:
+                            item = QtWidgets.QTableWidgetItem(str(c_int16(data[4] << 8 | data[3]).value))
+                            item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+                            self.bms_hard_ctl._view.hard_table.setItem(cell_vol_index - 1, 4, item)
+                    except:
+                        return
+                else:
+                    self.bms_hard_ctl._view.edt_cell.setText(str(c_int16(data[4] << 8 | data[3]).value))
+
+
     def run(self):
         self._view.show()

+ 8 - 5
controller/bms_protect_ctl.py

@@ -4,7 +4,7 @@
 
 from utils.globalvar import SD
 from widget.bms_protect import Win_Protect
-
+import decimal
 
 class BmsProtectControll:
     def __init__(self):
@@ -46,14 +46,17 @@ class BmsProtectControll:
 
     def _write_param(self):
         try:
+            value = (decimal.Decimal(self._view.qline_data_set.text()) - decimal.Decimal(self._view.qline_offset.text()))/decimal.Decimal(self._view.qline_fbl.text())
+            self._view.qline_data.setText(str(int(value) & 0xFFFF))
             data = []
             if len(data) < 8:
                 data += (8 - len(data)) * [0]
             data[0] = int(self._view.qline_addr.text(), 16) & 0xFF
             data[1] = int(self._view.qline_addr.text(), 16) >> 8
-            data[2] = int(float(self._view.qline_data.text())) & 0xFF
-            data[3] = int(float(self._view.qline_data.text())) >> 8 
+            data[2] = int(value) & 0xFF
+            data[3] = int(value) >> 8
             msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1802, data)
+            self._view.start_timer()
         except ValueError:
             self._view.set_error()
         except:
@@ -65,7 +68,7 @@ class BmsProtectControll:
             data = []
             if len(data) < 8:
                 data += (8 - len(data)) * [0]
-            data[0] = 0xEE
+            data[0] = 3
             data[1] = 0xFF
             data[6] = self.i
             self.i = self.i + 1
@@ -82,7 +85,7 @@ class BmsProtectControll:
             data = []
             if len(data) < 8:
                 data += (8 - len(data)) * [0]
-            data[0] = 3
+            data[0] = 0xEE
             data[1] = 0xFF
             data[6] = self.i
             self.i = self.i + 1

+ 1 - 2
start.py

@@ -9,12 +9,11 @@ from utils.qt import QApplication, QCoreApplication, Qt, QStyleFactory
 import locale
 
 
-
 def bms_start():
     # 主版本号
     SD.MAJOR_VERSION_NUMBER = 1
     # 子版本号
-    SD.MINOR_VERSION_NUMBER = 5
+    SD.MINOR_VERSION_NUMBER = 7
     # 修正版本号
     SD.REVISION_NUMBER = "0-build_test"
 

+ 57 - 115
ui/hard.py

@@ -3,11 +3,22 @@
 
 from ui.own.frame_theme import MyFrame
 from ui.own.palette_theme import set_edt_bg
-from utils.qt import QtWidgets, QtCore, Qt, QColor
+from utils.qt import QtWidgets, QtCore, Qt, QColor, QtGui
 
 
 class Hard(MyFrame):
     def setupUi(self, Hard):
+        self.reg = QtCore.QRegExp('^[\-\+]?\d+(\.\d)?$')
+        self.validator = QtGui.QRegExpValidator(self)
+        self.validator.setRegExp(self.reg)
+
+        self.reg = QtCore.QRegExp('^[\-\+]?\d+(\.\d\d\d)?$')
+        self.validator_1 = QtGui.QRegExpValidator(self)
+        self.validator_1.setRegExp(self.reg)
+
+        self.reg = QtCore.QRegExp('^[1-9]\d*$')
+        self.validator_2 = QtGui.QRegExpValidator(self)
+        self.validator_2.setRegExp(self.reg)
 
         self.hard = MyFrame(Hard)
         self.hard_layout = QtWidgets.QHBoxLayout(self.hard)
@@ -53,16 +64,12 @@ class Hard(MyFrame):
             item = QtWidgets.QTableWidgetItem("mV")
             item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
             self.hard_table.setItem(i, 5, item)
-            # if i == 0:
-            #     item = QtWidgets.QTableWidgetItem("所有单体电压")
-            #     item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-            #     self.hard_table.setItem(0, 1, item)               
-            # else:
             item = QtWidgets.QTableWidgetItem("C" + str(i + 1) + "单体电压")
             item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
             self.hard_table.setItem(i, 1, item)
             item = QtWidgets.QLineEdit()
             item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+            item.setValidator(self.validator_2)
             self.hard_table.setCellWidget(i, 2, item)  
             item = QtWidgets.QTableWidgetItem("")
             item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -128,17 +135,17 @@ class Hard(MyFrame):
         self.edt_cell = QtWidgets.QLineEdit(self.set_widget)
         self.edt_cell.setText("0")
         self.edt_cell.setAlignment(Qt.AlignCenter)
-        self.edt_cell.setReadOnly(True)
+        # self.edt_cell.setReadOnly(True)
         set_edt_bg(self.edt_cell, QColor(Qt.gray))
         self.set_widget_layout.addWidget(self.edt_cell, 1, 1, 1, 1)
 
         self.lb_dsw = QtWidgets.QLabel("mV")
         self.set_widget_layout.addWidget(self.lb_dsw, 1, 2, 1, 1)  
 
-        self.btn_hand = QtWidgets.QPushButton("手动校准")
+        self.btn_hand = QtWidgets.QPushButton("单体校准")
         self.set_widget_layout.addWidget(self.btn_hand, 1, 4, 1, 2)  
 
-        self.btn_auto = QtWidgets.QPushButton("自动校准")
+        self.btn_auto = QtWidgets.QPushButton("全部校准")
         self.set_widget_layout.addWidget(self.btn_auto, 1, 7, 1, 2)  
 
         self.hard_left_groupbox_layout.addWidget(self.set_widget)
@@ -155,24 +162,25 @@ class Hard(MyFrame):
         self.qline_rtc = QtWidgets.QLineEdit(self.rtc_groupbox)
         self.qline_rtc.setReadOnly(True)
         self.rtc_groupbox_layout.addWidget(self.qline_rtc)
-        # self.qcheckbox_rtc = QtWidgets.QCheckBox("实时更新")
-        # self.rtc_groupbox_layout.addWidget(self.qcheckbox_rtc)
         self.btn_rtc = QtWidgets.QPushButton("时钟校准")
         self.rtc_groupbox_layout.addWidget(self.btn_rtc)
         self.hard_right_frame_layout.addWidget(self.rtc_groupbox, 1)
 
 
-        self.vol_groupbox = QtWidgets.QGroupBox("总电压校准")
+        self.hard_right_cali_frame = MyFrame(self.hard_right_frame)
+        self.hard_right_cali_frame_layout = QtWidgets.QHBoxLayout(self.hard_right_cali_frame)
+
+        self.vol_groupbox = QtWidgets.QGroupBox("电压校准")
         self.vol_groupbox_layout = QtWidgets.QVBoxLayout(self.vol_groupbox)
         self.vol_table = QtWidgets.QTableWidget(self.vol_groupbox)
-        self.vol_table.setColumnCount(7)
+        self.vol_table.setColumnCount(4)
         self.vol_table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
         self.vol_table.verticalHeader().setVisible(False)
         self.vol_table.verticalHeader().setHighlightSections(True)
         self.vol_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
         self.vol_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
         self.vol_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
-        self.vol_table.setHorizontalHeaderLabels(["序号", "参数名称", "模拟总压值", "BMS上传值", "校准值", "误差", "单位"])
+        self.vol_table.setHorizontalHeaderLabels(["序号", "参数名称", "误差", "单位"])
         self.vol_table.setRowCount(3)
 
         item = QtWidgets.QTableWidgetItem("1")
@@ -183,20 +191,11 @@ class Hard(MyFrame):
         self.vol_table.setItem(0, 1, item)
         item = QtWidgets.QLineEdit()
         item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        item.setValidator(self.validator)
         self.vol_table.setCellWidget(0, 2, item)
-        item = QtWidgets.QTableWidgetItem("")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(0, 3, item)
-        item = QtWidgets.QLineEdit()
-        item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setCellWidget(0, 4, item)
-        item = QtWidgets.QTableWidgetItem("")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(0, 5, item)
         item = QtWidgets.QTableWidgetItem("V")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(0, 6, item)
-
+        self.vol_table.setItem(0, 3, item)
         item = QtWidgets.QTableWidgetItem("2")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.vol_table.setItem(1, 0, item)
@@ -205,20 +204,11 @@ class Hard(MyFrame):
         self.vol_table.setItem(1, 1, item)
         item = QtWidgets.QLineEdit()
         item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        item.setValidator(self.validator)
         self.vol_table.setCellWidget(1, 2, item)
-        item = QtWidgets.QTableWidgetItem("")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(1, 3, item)
-        item = QtWidgets.QLineEdit()
-        item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setCellWidget(1, 4, item)
-        item = QtWidgets.QTableWidgetItem("")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(1, 5, item)
         item = QtWidgets.QTableWidgetItem("V")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(1, 6, item)
-
+        self.vol_table.setItem(1, 3, item)
         item = QtWidgets.QTableWidgetItem("3")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.vol_table.setItem(2, 0, item)
@@ -227,91 +217,43 @@ class Hard(MyFrame):
         self.vol_table.setItem(2, 1, item)
         item = QtWidgets.QLineEdit()
         item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        item.setValidator(self.validator)
         self.vol_table.setCellWidget(2, 2, item)
-        item = QtWidgets.QTableWidgetItem("")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(2, 3, item)
-        item = QtWidgets.QLineEdit()
-        item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setCellWidget(2, 4, item)
-        item = QtWidgets.QTableWidgetItem("")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(2, 5, item)
         item = QtWidgets.QTableWidgetItem("V")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.vol_table.setItem(2, 6, item)
+        self.vol_table.setItem(2, 3, item)
 
         self.vol_groupbox_layout.addWidget(self.vol_table)
         self.vol_widget = QtWidgets.QWidget(self.vol_groupbox)
         self.vol_widget_layout = QtWidgets.QHBoxLayout(self.vol_widget)
-        self.btn_hand_cali = QtWidgets.QPushButton("手动校准")
-        self.vol_widget_layout.addWidget(self.btn_hand_cali)
-        self.btn_auto_cali = QtWidgets.QPushButton("自动校准")
-        self.vol_widget_layout.addWidget(self.btn_auto_cali)
+        self.btn_pack_vol_cali = QtWidgets.QPushButton("电压校准")
+        self.vol_widget_layout.addWidget(self.btn_pack_vol_cali)
         self.vol_groupbox_layout.addWidget(self.vol_widget)
-        self.hard_right_frame_layout.addWidget(self.vol_groupbox, 3)
-
-
-        self.cur_groupbox = QtWidgets.QGroupBox("总电流校准")
-        self.cur_groupbox_layout = QtWidgets.QVBoxLayout(self.cur_groupbox)
-        self.cur_table = QtWidgets.QTableWidget(self.cur_groupbox)
-        self.cur_table.setColumnCount(5)
-        self.cur_table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
-        self.cur_table.verticalHeader().setVisible(False)
-        self.cur_table.verticalHeader().setHighlightSections(True)
-        self.cur_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
-        self.cur_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
-        self.cur_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
-        self.cur_table.setHorizontalHeaderLabels(["测试工步", "STEP1", "STEP2", "STEP3", "单位"])
-        self.cur_table.setRowCount(3)
-
-        item = QtWidgets.QTableWidgetItem("模拟电流值")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setItem(0, 0, item)
-        item = QtWidgets.QLineEdit()
-        item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setCellWidget(0, 1, item)
-        item = QtWidgets.QLineEdit()
-        item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setCellWidget(0, 2, item)
-        item = QtWidgets.QLineEdit()
-        item.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setCellWidget(0, 3, item)
-        item = QtWidgets.QTableWidgetItem("A")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setItem(0, 4, item)
-
-        item = QtWidgets.QTableWidgetItem("BMS上传值")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setItem(1, 0, item)
-        item = QtWidgets.QTableWidgetItem("A")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setItem(1, 4, item)
-
-        item = QtWidgets.QTableWidgetItem("误差")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setItem(2, 0, item)
-        item = QtWidgets.QTableWidgetItem("A")
-        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
-        self.cur_table.setItem(2, 4, item)
+        # self.hard_right_frame_layout.addWidget(self.vol_groupbox, 3)
+        self.hard_right_cali_frame_layout.addWidget(self.vol_groupbox, 2)
 
-        self.cur_groupbox_layout.addWidget(self.cur_table)
-        self.cur_widget = QtWidgets.QWidget(self.cur_groupbox)
-        self.cur_widget_layout = QtWidgets.QHBoxLayout(self.cur_widget)
+        self.cur_groupbox = QtWidgets.QGroupBox("电流校准")
+        self.cur_groupbox_layout = QtWidgets.QGridLayout(self.cur_groupbox)
         self.lb_cali = QtWidgets.QLabel("增益校准值")
-        self.cur_widget_layout.addWidget(self.lb_cali)
-        self.qline_cali = QtWidgets.QLabel(self.cur_widget)
-        self.cur_widget_layout.addWidget(self.qline_cali)
-        self.lb_zero = QtWidgets.QLabel("零漂校准值")
-        self.cur_widget_layout.addWidget(self.lb_zero)
-        self.qline_zero = QtWidgets.QLabel(self.cur_widget)
-        self.cur_widget_layout.addWidget(self.qline_zero)
-        self.btn_cur_hand_cali = QtWidgets.QPushButton("手动校准")
-        self.cur_widget_layout.addWidget(self.btn_cur_hand_cali)
-        self.btn_hand_auto_cali = QtWidgets.QPushButton("自动校准")
-        self.cur_widget_layout.addWidget(self.btn_hand_auto_cali)
-        self.cur_groupbox_layout.addWidget(self.cur_widget)
-        self.hard_right_frame_layout.addWidget(self.cur_groupbox, 3)
+        self.cur_groupbox_layout.addWidget(self.lb_cali, 0, 0)
+        self.qline_cali_fbl = QtWidgets.QLineEdit(self.cur_groupbox)
+        self.qline_cali_fbl.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.qline_cali_fbl.setValidator(self.validator_1)
+        self.cur_groupbox_layout.addWidget(self.qline_cali_fbl, 0, 1)
+        self.lb_zero = QtWidgets.QLabel("偏移准值")
+        self.cur_groupbox_layout.addWidget(self.lb_zero, 1, 0)
+        self.qline_cur_offset = QtWidgets.QLineEdit(self.cur_groupbox)
+        self.qline_cur_offset.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.qline_cur_offset.setValidator(self.validator)
+        self.cur_groupbox_layout.addWidget(self.qline_cur_offset,1, 1)
+        self.lb_dw = QtWidgets.QLabel("A")
+        self.cur_groupbox_layout.addWidget(self.lb_dw, 1, 2)
+        self.btn_cur_cali = QtWidgets.QPushButton("电流校准")
+        self.cur_groupbox_layout.addWidget(self.btn_cur_cali, 2, 0, 1, 3)
+        # self.hard_right_frame_layout.addWidget(self.cur_groupbox, 3)
+        self.hard_right_cali_frame_layout.addWidget(self.cur_groupbox, 1)
+
+        self.hard_right_frame_layout.addWidget(self.hard_right_cali_frame, 3)
 
         self.temp_groupbox = QtWidgets.QGroupBox("从控温度配置")
         self.temp_groupbox_layout = QtWidgets.QHBoxLayout(self.temp_groupbox)
@@ -322,16 +264,16 @@ class Hard(MyFrame):
         self.temp_qwidget = QtWidgets.QWidget()
         self.temp_qscrollarea.setWidget(self.temp_qwidget)
         self.temp_qscrollarea_layout = QtWidgets.QGridLayout(self.temp_qwidget)
-        # self.temp_qscrollarea_layout.setContentsMargins(3, 3, 3, 3)
+        self.temp_qscrollarea_layout.setContentsMargins(3, 3, 3, 3)
         self.temp_qscrollarea_layout.setSpacing(0)
         for i in range(16):
             if i == 0:
                 bmu_label = QtWidgets.QLabel("CMU ID")
-                # bmu_label.setAlignment(Qt.AlignCenter)
+                bmu_label.setAlignment(Qt.AlignCenter)
                 self.temp_qscrollarea_layout.addWidget(bmu_label, i, 0, 1, 1)  
             else:              
                 bmu_label = QtWidgets.QLabel("CMU" + str(i))
-                # bmu_label.setAlignment(Qt.AlignCenter)
+                bmu_label.setAlignment(Qt.AlignCenter)
                 self.temp_qscrollarea_layout.addWidget(bmu_label, i, 0, 1, 1)
         for i in range(16):
             for j in range(72):
@@ -347,7 +289,7 @@ class Hard(MyFrame):
                     # qtemp_lebal.setReadOnly(True)
                     self.temp_qscrollarea_layout.addWidget(qtemp_checkbox, i, j + 1, 1, 1)
 
-        self.hard_right_frame_layout.addWidget(self.temp_groupbox, 2)
+        self.hard_right_frame_layout.addWidget(self.temp_groupbox, 5)
         
         self.btn_widget = QtWidgets.QWidget()
         self.btn_widget_layout = QtWidgets.QHBoxLayout(self.btn_widget)

+ 2 - 2
ui/main/under_page.py

@@ -42,14 +42,14 @@ class UnderPage(QtWidgets.QWidget):
         # self.under_left_groupbox_layout.addItem(spacerItem1)
 
         self.sys_status_no = QtWidgets.QLineEdit(self.under_left_groupbox)
-        self.sys_status_no.setText("上电")
+        self.sys_status_no.setText("低压")
         self.sys_status_no.setAlignment(Qt.AlignCenter)
         self.sys_status_no.setReadOnly(True)
         set_edt_bg(self.sys_status_no, QColor(Qt.gray))
         self.under_left_groupbox_layout.addWidget(self.sys_status_no, 1, 1)
 
         self.sys_status_high_no = QtWidgets.QLineEdit(self.under_left_groupbox)
-        self.sys_status_high_no.setText("待机")
+        self.sys_status_high_no.setText("高压")
         self.sys_status_high_no.setAlignment(Qt.AlignCenter)
         self.sys_status_high_no.setReadOnly(True)
         set_edt_bg(self.sys_status_high_no, QColor(Qt.gray))

+ 128 - 32
ui/protect.py

@@ -274,9 +274,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(20, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(20, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(20, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电高温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -284,9 +287,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(21, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(21, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(21, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电高温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -294,9 +300,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(22, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(22, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(22, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电高温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -304,9 +313,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(23, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(23, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(23, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电低温三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -314,9 +326,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(24, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(24, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(24, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电低温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -324,9 +339,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(25, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(25, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(25, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电低温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -334,9 +352,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(26, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(26, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(26, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电低温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -344,9 +365,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(27, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(27, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(27, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电高温三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -354,9 +378,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(28, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(28, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(28, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电高温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -364,9 +391,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(29, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(29, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(29, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电高温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -374,9 +404,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(30, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(30, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(30, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电高温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -384,9 +417,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(31, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(31, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(31, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电低温三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -394,9 +430,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(32, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(32, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(32, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电低温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -404,9 +443,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(33, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(33, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(33, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电低温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -414,9 +456,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(34, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(34, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(34, 7, item)
 
         item = QtWidgets.QTableWidgetItem("放电低温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -424,9 +469,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(35, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(35, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(35, 7, item)
 
         item = QtWidgets.QTableWidgetItem("充电过流三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -514,9 +562,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(44, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(44, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(44, 7, item)
 
         item = QtWidgets.QTableWidgetItem("电芯温差二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -524,9 +575,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(45, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(45, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(45, 7, item)
 
         item = QtWidgets.QTableWidgetItem("电芯温差一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -534,9 +588,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(46, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(46, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(46, 7, item)
 
         item = QtWidgets.QTableWidgetItem("电芯温差恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -544,9 +601,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(47, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(47, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(47, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -554,9 +614,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(48, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(48, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(48, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -564,9 +627,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(49, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(49, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(49, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -574,9 +640,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(50, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(50, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(50, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -584,9 +653,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(51, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(51, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(51, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -594,9 +666,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(52, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(52, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(52, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -604,9 +679,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(53, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(53, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(53, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -614,9 +692,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(54, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(54, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(54, 7, item)
 
         item = QtWidgets.QTableWidgetItem("MOS高温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -624,9 +705,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(55, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(55, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(55, 7, item)
 
         item = QtWidgets.QTableWidgetItem("绝缘过低三级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -855,9 +939,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(78, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(78, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(78, 7, item)
 
         item = QtWidgets.QTableWidgetItem("AFE高温二级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -865,9 +952,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(79, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(79, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(79, 7, item)
 
         item = QtWidgets.QTableWidgetItem("AFE高温一级告警")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -875,9 +965,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(80, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(80, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(80, 7, item)
 
         item = QtWidgets.QTableWidgetItem("AFE高温恢复回差阈值")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
@@ -885,9 +978,12 @@ class Protect(MyFrame):
         item = QtWidgets.QTableWidgetItem("℃")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(81, 2, item)
-        item = QtWidgets.QTableWidgetItem("1")
+        item = QtWidgets.QTableWidgetItem("0.1")
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(81, 6, item)
+        item = QtWidgets.QTableWidgetItem("-40")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(81, 7, item)
 
         # item = QtWidgets.QTableWidgetItem("单体过压三级告警")
         # item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

+ 32 - 0
widget/bms_hard.py

@@ -9,13 +9,27 @@ from utils.qt import QMessageBox, Signal
 from functools import partial
 
 class Win_Hard(Hard, MyFrame):
+
     rtc_update_signal = Signal()
+    read_hard_signal = Signal()
+    write_param_signal = Signal()
+    exit_hard_signal = Signal()
+    pack_vol_cali_signal = Signal()
+    cur_cali_signal = Signal()
+    cell_vol_one_cali_signal = Signal()
+    cell_vol_all_cali_signal = Signal()
 
     def __init__(self, parent=None):
         super(Win_Hard, self).__init__(parent)
         self.setupUi(self)
 
         self.btn_rtc.clicked.connect(self._rtc_update)
+        self.btn_read_hard_param.clicked.connect(self.on_btn_read_hard)
+        self.btn_exit_hard_param.clicked.connect(self.on_btn_exit_hard)
+        self.btn_pack_vol_cali.clicked.connect(self._on_btn_pack_vol_cali)
+        self.btn_cur_cali.clicked.connect(self._on_btn_cur_cali)
+        self.btn_hand.clicked.connect(self._on_btn_hand)
+        self.btn_auto.clicked.connect(self._on_btn_auto)
 
         for i in range(64):
                 self.hard_table.cellWidget(i, 2).editingFinished.connect(partial(self._set_diff, i))
@@ -23,6 +37,24 @@ class Win_Hard(Hard, MyFrame):
     def _rtc_update(self):
          self.rtc_update_signal.emit()
 
+    def on_btn_read_hard(self):
+        self.read_hard_signal.emit()
+
+    def on_btn_exit_hard(self):
+        self.exit_hard_signal.emit()
+
+    def _on_btn_pack_vol_cali(self):
+        self.pack_vol_cali_signal.emit()
+
+    def _on_btn_cur_cali(self):
+        self.cur_cali_signal.emit()
+
+    def _on_btn_hand(self):
+        self.cell_vol_one_cali_signal.emit()
+
+    def _on_btn_auto(self):
+        self.cell_vol_all_cali_signal.emit()
+
     def _set_diff(self, i):
         try:
             diff = int(float(self.hard_table.cellWidget(i, 2).text())) - int(self.hard_table.item(i, 3).text())

+ 18 - 6
widget/bms_protect.py

@@ -5,7 +5,7 @@
 from ui.protect import Protect
 from ui.own.frame_theme import MyFrame
 from utils.globalvar import SD
-from utils.qt import QMessageBox, Signal
+from utils.qt import QMessageBox, Signal, QTimer
 
 
 class Win_Protect(Protect, MyFrame):
@@ -25,13 +25,20 @@ class Win_Protect(Protect, MyFrame):
         self.btn_exit_param.clicked.connect(self.on_btn_exit_param)
         self.btn_reset_param.clicked.connect(self.on_btn_reset_param)
         self.protect_table.itemClicked.connect(self._param_item_clicked)
-        self.qline_data_set.returnPressed.connect(self._protect_data_changed)
+        # self.qline_data_set.returnPressed.connect(self._protect_data_changed)
 
+        self.timer = QTimer()
+        self.timer.timeout.connect(self.over_time)
 
+    def start_timer(self):
+        self.timer.start(3000)
+    
+    def end_timer(self):   
+        self.timer.stop()
+    
     def on_btn_read_param(self):
         self.read_param_signal.emit()
 
-
     def on_btn_write_param(self):
         self.write_param_signal.emit()
 
@@ -41,9 +48,9 @@ class Win_Protect(Protect, MyFrame):
     def on_btn_reset_param(self):
         self.reset_param_signal.emit()
 
-    def _protect_data_changed(self):
-        value = (float(self.qline_data_set.text()) - float(self.qline_offset.text()))/float(self.qline_fbl.text())
-        self.qline_data.setText(str(value))
+    # def _protect_data_changed(self):
+    #     value = (float(self.qline_data_set.text()) - float(self.qline_offset.text()))/float(self.qline_fbl.text())
+    #     self.qline_data.setText(str(value))
 
 
     def _param_item_clicked(self, index):
@@ -62,3 +69,8 @@ class Win_Protect(Protect, MyFrame):
 
     def can_connect_error(self):
         QMessageBox.critical(self, "连接状态" if SD.SYSTEM_LANGUAGE == 0 else "Connect State", "CAN 连接失败!" if SD.SYSTEM_LANGUAGE == 0 else "CAN Connect Error!")
+
+
+    def over_time(self):
+        self.timer.stop()
+        QMessageBox.critical(self, "错误" if SD.SYSTEM_LANGUAGE == 0 else "Error", "参数设置超时!" if SD.SYSTEM_LANGUAGE == 0 else "Param Set OverTime!")

+ 8 - 1
worker/bms_work.py

@@ -45,6 +45,8 @@ class BmsReceived(QObject):
     to_show_0021_signal = Signal(object, int)
     to_show_0022_signal = Signal(object, int)
     to_show_0023_signal = Signal(object, int)
+    to_show_1802_signal = Signal(object, int)
+    to_show_1803_signal = Signal(object, int)
 
     def __init__(self):
         super(BmsReceived, self).__init__()
@@ -172,4 +174,9 @@ class BmsReceived(QObject):
                 # 0023
                 elif (result[1] ^ 0x18000023) & 0xFFFF == 0:
                     self.to_show_0023_signal.emit(result[2], (result[1] >> 16) & 0xFF)
-                    
+                # 1802
+                elif (result[1] ^ 0x18001802) & 0xFFFF == 0:
+                    self.to_show_1802_signal.emit(result[2], (result[1] >> 16) & 0xFF)
+                # 1803
+                elif (result[1] ^ 0x18001803) & 0xFFFF == 0:
+                    self.to_show_1803_signal.emit(result[2], (result[1] >> 16) & 0xFF)