Browse Source

1.2版本发布,增加一部分内容

Franike 10 months ago
parent
commit
0e7c9baa96

+ 66 - 69
controller/bms_home_ctl.py

@@ -23,7 +23,7 @@ from utils.globalvar import SD
 from controller.bms_main_ctl import BmsMainControll
 from controller.bms_main_ctl import BmsMainControll
 from utils.qt import QTimer, QThread, QColor, Qt, QDateTime, QtGui, QtWidgets, QPixmap,QApplication
 from utils.qt import QTimer, QThread, QColor, Qt, QDateTime, QtGui, QtWidgets, QPixmap,QApplication
 from utils.hex_bit import a_bit
 from utils.hex_bit import a_bit
-from worker.bms_work import BmsSend, BmsReceived
+from worker.bms_work import BmsReceived
 from ui.own.palette_theme import set_edt_bg
 from ui.own.palette_theme import set_edt_bg
 import csv
 import csv
 
 
@@ -322,10 +322,23 @@ class BmsHomeControll:
                 set_edt_bg(self.bms_main_ctl._view.under_widget.mos_chg, QColor(Qt.gray) if (data[7] & 0x02 == 0) else QColor(Qt.green))
                 set_edt_bg(self.bms_main_ctl._view.under_widget.mos_chg, QColor(Qt.gray) if (data[7] & 0x02 == 0) else QColor(Qt.green))
                 set_edt_bg(self.bms_main_ctl._view.under_widget.mos_pre, QColor(Qt.gray) if (data[7] & 0x04 == 0) else QColor(Qt.green))
                 set_edt_bg(self.bms_main_ctl._view.under_widget.mos_pre, QColor(Qt.gray) if (data[7] & 0x04 == 0) else QColor(Qt.green))
             
             
-            if SD.CCU_TYPE == 1: 
-                set_edt_bg(self.bms_main_ctl._view.under_widget.do_4, QColor(Qt.gray) if (data[7] & 0x08 == 0) else QColor(Qt.green))
-                set_edt_bg(self.bms_main_ctl._view.under_widget.do_3, QColor(Qt.gray) if (data[7] & 0x40 == 0) else QColor(Qt.green))
-                set_edt_bg(self.bms_main_ctl._view.under_widget.do_5, QColor(Qt.gray) if (data[7] & 0x80 == 0) else QColor(Qt.green))
+            # if SD.CCU_TYPE == 1: 
+            #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_4, QColor(Qt.gray) if (data[7] & 0x08 == 0) else QColor(Qt.green))
+            #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_3, QColor(Qt.gray) if (data[7] & 0x40 == 0) else QColor(Qt.green))
+            #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_5, QColor(Qt.gray) if (data[7] & 0x80 == 0) else QColor(Qt.green))
+
+            # 充电MOS故障
+            if a_bit(data[7], 5) == 0:
+                set_edt_bg(self.bms_main_ctl._view.center_widget.chg_mos_fault, QColor(Qt.gray))
+            else:
+                set_edt_bg(self.bms_main_ctl._view.center_widget.chg_mos_fault, QColor(Qt.red))
+
+            # 放电MOS故障
+            if a_bit(data[5], 4) == 0:
+                set_edt_bg(self.bms_main_ctl._view.center_widget.dchg_mos_fault, QColor(Qt.gray))
+            else:
+                set_edt_bg(self.bms_main_ctl._view.center_widget.dchg_mos_fault, QColor(Qt.red))
+
 
 
             set_edt_bg(self.bms_main_ctl._view.under_widget.permit_chg, QColor(Qt.gray) if (data[0] & 0x40 == 0) else QColor(Qt.red))
             set_edt_bg(self.bms_main_ctl._view.under_widget.permit_chg, QColor(Qt.gray) if (data[0] & 0x40 == 0) else QColor(Qt.red))
             set_edt_bg(self.bms_main_ctl._view.under_widget.permit_dchg, QColor(Qt.gray) if (data[0] & 0x80 == 0) else QColor(Qt.red))
             set_edt_bg(self.bms_main_ctl._view.under_widget.permit_dchg, QColor(Qt.gray) if (data[0] & 0x80 == 0) else QColor(Qt.red))
@@ -506,24 +519,26 @@ class BmsHomeControll:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.against_warn, QColor(Qt.yellow))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.against_warn, QColor(Qt.yellow))
 
 
             # 正极绝缘过低报警
             # 正极绝缘过低报警
-            if ((data[3] & 0x0C) >> 2) == 0:
+            if a_bit(data[3], 3) == 0:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.gray))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.gray))
-            elif ((data[3] & 0x0C) >> 2) == 1:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.red))
-            elif ((data[3] & 0x0C) >> 2) == 2:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.magenta))
             else:
             else:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.yellow))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.red))
 
 
             # 负极绝缘过低报警
             # 负极绝缘过低报警
-            if ((data[3] & 0x30) >> 4) == 0:
+            if a_bit(data[3], 4) == 0:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.gray))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.gray))
-            elif ((data[3] & 0x30) >> 4) == 1:
+            else:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.red))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.red))
+
+            # AFE温度过高
+            if ((data[3] & 0x30) >> 4) == 0:
+                set_edt_bg(self.bms_main_ctl._view.center_widget.afe_high_temp_fault, QColor(Qt.gray))
+            elif ((data[3] & 0x30) >> 4) == 1:
+                set_edt_bg(self.bms_main_ctl._view.center_widget.afe_high_temp_fault, QColor(Qt.red))
             elif ((data[3] & 0x30) >> 4) == 2:
             elif ((data[3] & 0x30) >> 4) == 2:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.magenta))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.afe_high_temp_fault, QColor(Qt.magenta))
             else:
             else:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.p_against_warn, QColor(Qt.yellow))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.afe_high_temp_fault, QColor(Qt.yellow))
 
 
             # 极柱温度过高
             # 极柱温度过高
             if ((data[3] & 0xC0) >> 6) == 0:
             if ((data[3] & 0xC0) >> 6) == 0:
@@ -542,7 +557,7 @@ class BmsHomeControll:
             else:
             else:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.vol_fault, QColor(Qt.red))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.vol_fault, QColor(Qt.red))
             
             
-            # 总压检测故障
+            # 电流检测故障
             if a_bit(data[4], 2) == 0:
             if a_bit(data[4], 2) == 0:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.cur_fault, QColor(Qt.gray))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.cur_fault, QColor(Qt.gray))
             else:
             else:
@@ -597,17 +612,29 @@ class BmsHomeControll:
             else:
             else:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.pre_chg_fault, QColor(Qt.red))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.pre_chg_fault, QColor(Qt.red))
 
 
-            # 充电MOS故障
+            # 绝缘检测故障
             if a_bit(data[5], 3) == 0:
             if a_bit(data[5], 3) == 0:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.chg_mos_fault, QColor(Qt.gray))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.against_fault, QColor(Qt.gray))
             else:
             else:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.chg_mos_fault, QColor(Qt.red))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.against_fault, QColor(Qt.red))
 
 
-            # 放电MOS故障
+            # 从控硬件故障
             if a_bit(data[5], 4) == 0:
             if a_bit(data[5], 4) == 0:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.dchg_mos_fault, QColor(Qt.gray))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.bcu_hard_fault, QColor(Qt.gray))
             else:
             else:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.dchg_mos_fault, QColor(Qt.red))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.bcu_hard_fault, QColor(Qt.red))
+
+            # # 充电MOS故障
+            # if a_bit(data[5], 3) == 0:
+            #     set_edt_bg(self.bms_main_ctl._view.center_widget.chg_mos_fault, QColor(Qt.gray))
+            # else:
+            #     set_edt_bg(self.bms_main_ctl._view.center_widget.chg_mos_fault, QColor(Qt.red))
+
+            # # 放电MOS故障
+            # if a_bit(data[5], 4) == 0:
+            #     set_edt_bg(self.bms_main_ctl._view.center_widget.dchg_mos_fault, QColor(Qt.gray))
+            # else:
+            #     set_edt_bg(self.bms_main_ctl._view.center_widget.dchg_mos_fault, QColor(Qt.red))
 
 
             # 风扇控制失效
             # 风扇控制失效
             if a_bit(data[5], 5) == 0:
             if a_bit(data[5], 5) == 0:
@@ -688,12 +715,12 @@ class BmsHomeControll:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.jump_fault, QColor(Qt.gray))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.jump_fault, QColor(Qt.gray))
             else:
             else:
                 set_edt_bg(self.bms_main_ctl._view.center_widget.jump_fault, QColor(Qt.red))
                 set_edt_bg(self.bms_main_ctl._view.center_widget.jump_fault, QColor(Qt.red))
-            
-            # 极柱温度过高故障
+
+            # 隔离开关故障
             if a_bit(data[7], 2) == 0:
             if a_bit(data[7], 2) == 0:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.jz_ht_warn, QColor(Qt.gray))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.glkg_fault, QColor(Qt.gray))
             else:
             else:
-                set_edt_bg(self.bms_main_ctl._view.center_widget.jz_ht_warn, QColor(Qt.red))
+                set_edt_bg(self.bms_main_ctl._view.center_widget.glkg_fault, QColor(Qt.red))
 
 
             # 主控检测温度过高故障
             # 主控检测温度过高故障
             if a_bit(data[7], 3) == 0:
             if a_bit(data[7], 3) == 0:
@@ -1028,49 +1055,19 @@ class BmsHomeControll:
             # self.bms_main_ctl._view.top_widget.lb_h_temp_in_index_value.setText(str(data[7]))
             # self.bms_main_ctl._view.top_widget.lb_h_temp_in_index_value.setText(str(data[7]))
 
 
     def _inf_0012_signal(self, data, id):
     def _inf_0012_signal(self, data, id):
-        return
-        # if SD.CCU_TYPE == 1:
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_1, QColor(Qt.gray) if (data[0] & 0x01 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_2, QColor(Qt.gray) if (data[0] & 0x02 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_3, QColor(Qt.gray) if (data[0] & 0x04 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_4, QColor(Qt.gray) if (data[0] & 0x08 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_5, QColor(Qt.gray) if (data[0] & 0x10 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_6, QColor(Qt.gray) if (data[0] & 0x20 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_7, QColor(Qt.gray) if (data[0] & 0x40 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.di_8, QColor(Qt.gray) if (data[0] & 0x80 == 0) else QColor(Qt.green))
-
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_1, QColor(Qt.gray) if (data[1] & 0x01 == 0) else QColor(Qt.green))
-        #     self._model.p(data[1] & 0x01)
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_2, QColor(Qt.gray) if (data[1] & 0x02 == 0) else QColor(Qt.green))
-        #     self._model.n((data[1] & 0x02) >> 1)
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_3, QColor(Qt.gray) if (data[1] & 0x04 == 0) else QColor(Qt.green))
-        #     self._model.pre((data[1] & 0x04) >> 2)
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_4, QColor(Qt.gray) if (data[1] & 0x08 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_5, QColor(Qt.gray) if (data[1] & 0x10 == 0) else QColor(Qt.green))
-        #     self._model.dlq((data[1] & 0x10) >> 4)
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_6, QColor(Qt.gray) if (data[1] & 0x20 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_7, QColor(Qt.gray) if (data[1] & 0x40 == 0) else QColor(Qt.green))
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.do_8, QColor(Qt.gray) if (data[1] & 0x80 == 0) else QColor(Qt.green))
-        # else:
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.fjd_1, QColor(Qt.gray) if (data[2] & 0x01 == 0) else QColor(Qt.green))
-        #     self._model.gjd_first(data[2] & 0x01)
-        #     set_edt_bg(self.bms_main_ctl._view.under_widget.fjd_1, QColor(Qt.gray) if (data[2] & 0x02 == 0) else QColor(Qt.green))
-        #     self._model.gjd_second((data[2] & 0x02) >> 1)
-              
-
-    # def _inf_0013_signal(self, data):
-    #     # BMS 电池编码								
-    #     self.bms_sn_version = ["" for i in range(8)]
-    #     self.bms_sn_version[0] = chr(data[0])
-    #     self.bms_sn_version[1] = chr(data[1])
-    #     self.bms_sn_version[2] = chr(data[2])
-    #     self.bms_sn_version[3] = chr(data[3])
-    #     self.bms_sn_version[4] = chr(data[4])
-    #     self.bms_sn_version[5] = chr(data[5])
-    #     self.bms_sn_version[6] = chr(data[6])
-    #     self.bms_sn_version[7] = chr(data[7])
-    #     bms_sn_version = ''.join(self.bms_sn_version)
-    #     self.bms_download_ctl._view.message_table.cellWidget(5, 2).setText(bms_sn_version)
+        if id == SD.BCU_ID:
+            # 最高AFE温度值
+            self.bms_main_ctl._view.top_widget.lb_afe_temp_high_value.setText(str(round((data[1] << 8 | data[0]) * 0.1 - 40, 1)))
+            # 最高AFE温度所在从控编号
+            self.bms_main_ctl._view.top_widget.lb_afe_temp_high_slave_value.setText(str(data[2]))
+            # 最高AFE温度所在从控内编号
+            self.bms_main_ctl._view.top_widget.lb_afe_temp_high_slave_in_value.setText(str(data[3]))
+            # 最低AFE温度值
+            self.bms_main_ctl._view.top_widget.lb_afe_temp_low_value.setText(str(round((data[5] << 8 | data[4]) * 0.1 - 40, 1)))
+            # 最低AFE温度所在从控编号
+            self.bms_main_ctl._view.top_widget.lb_afe_temp_low_slave_value.setText(str(data[6]))
+            # 最低AFE温度所在从控内编号
+            self.bms_main_ctl._view.top_widget.lb_afe_temp_low_slave_in_value.setText(str(data[7]))
 
 
 
 
     def _inf_0013_signal(self, data, id):
     def _inf_0013_signal(self, data, id):

+ 0 - 1
controller/bms_main_ctl.py

@@ -100,7 +100,6 @@ class BmsMainControll:
                 data[7] = data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6]
                 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)
                 msg = SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x1801, data)
             except:
             except:
-                # self._view.under_widget.snkz_check_box.setCheckState(Qt.Unchecked)
                 self._view.can_connect_error()
                 self._view.can_connect_error()
         else:
         else:
             try:
             try:

+ 0 - 1
controller/bms_record_ctl.py

@@ -3,7 +3,6 @@
 
 
 
 
 import csv
 import csv
-from utils.delay import m_delay
 from utils.globalvar import SD
 from utils.globalvar import SD
 from widget.bms_record import Win_Record
 from widget.bms_record import Win_Record
 from model.record_model import RecordModel
 from model.record_model import RecordModel

+ 0 - 3
controller/bms_set_ctl.py

@@ -2,10 +2,7 @@
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
 
 
-from utils.delay import m_delay
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.hex_bit import a_bit
-from utils.log_signal import LogSignal
 from widget.bms_set import Win_Set
 from widget.bms_set import Win_Set
 
 
 
 

+ 0 - 4
controller/bms_status_ctl.py

@@ -9,12 +9,8 @@
 '''
 '''
 
 
 
 
-from utils.delay import m_delay
-from utils.globalvar import SD
-from os import path
 from widget.bms_status_bar import Win_Bms_Status_Bar
 from widget.bms_status_bar import Win_Bms_Status_Bar
 
 
-
 class BmsStatusControll:
 class BmsStatusControll:
     def __init__(self):
     def __init__(self):
         self._view = Win_Bms_Status_Bar()
         self._view = Win_Bms_Status_Bar()

+ 1 - 1
start.py

@@ -22,7 +22,7 @@ def bms_start():
     # 主版本号
     # 主版本号
     SD.MAJOR_VERSION_NUMBER = 1
     SD.MAJOR_VERSION_NUMBER = 1
     # 子版本号
     # 子版本号
-    SD.MINOR_VERSION_NUMBER = 1
+    SD.MINOR_VERSION_NUMBER = 2
     # 修正版本号
     # 修正版本号
     SD.REVISION_NUMBER = "0-build_test"
     SD.REVISION_NUMBER = "0-build_test"
 
 

+ 1 - 4
ui/balance.py

@@ -2,10 +2,7 @@
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.main.center_page import CenterPage
-from ui.main.under_page import UnderPage
-from utils.qt import QtWidgets, QtCore, Qt, QtGui
-from ui.own.palette_theme import set_edt_bg
+from utils.qt import QtWidgets, QtCore, Qt
 
 
 class Balance(MyFrame):
 class Balance(MyFrame):
     def setupUi(self, Balance):
     def setupUi(self, Balance):

+ 0 - 3
ui/double_ccu.py

@@ -2,9 +2,6 @@
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.main.top_page import TopPage
-from ui.main.center_page import CenterPage
-from ui.main.under_page import UnderPage
 from utils.qt import QtWidgets, QtCore
 from utils.qt import QtWidgets, QtCore
 
 
 
 

+ 0 - 3
ui/download.py

@@ -2,9 +2,6 @@
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.main.top_page import TopPage
-from ui.main.center_page import CenterPage
-from ui.main.under_page import UnderPage
 from utils.qt import QtWidgets, QtCore, Qt, QtGui
 from utils.qt import QtWidgets, QtCore, Qt, QtGui
 
 
 
 

+ 1 - 5
ui/home.py

@@ -2,12 +2,8 @@
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
 import os
 import os
-from ui.own.frame_theme import MyFrame
-from utils.globalvar import SD
-from ui.own.led import Led
-from ui.own.switch_button import SwitchButton
 from ui.own.palette_theme import set_my_palette
 from ui.own.palette_theme import set_my_palette
-from utils.qt import Qt, QWidget, QVBoxLayout, QHBoxLayout, QStackedWidget, QPixmap, QLabel, QGroupBox, QRect, QPushButton, QSizePolicy, QLineEdit, QTabWidget, QComboBox, QPlainTextEdit, QSize, QCoreApplication, QMetaObject, QIcon
+from utils.qt import Qt, QWidget, QVBoxLayout, QHBoxLayout, QStackedWidget, QPixmap, QLabel, QPushButton, QSizePolicy, QLineEdit, QComboBox, QCoreApplication, QMetaObject, QIcon
 from utils.resource import resource_path
 from utils.resource import resource_path
 
 
 
 

+ 1 - 2
ui/login.py

@@ -3,9 +3,8 @@
 
 
 import os
 import os
 from ui.own.palette_theme import set_my_palette, set_sure_background
 from ui.own.palette_theme import set_my_palette, set_sure_background
-from utils.resource import resource_path
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QPixmap, Qt, QFont, QWidget, QComboBox, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QLineEdit, QSize, QRect, QCoreApplication, QMetaObject
+from utils.qt import QWidget, QComboBox, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QLineEdit, QSize, QRect, QCoreApplication, QMetaObject
 
 
 
 
 class UiBmsLoginPage(object):
 class UiBmsLoginPage(object):

+ 27 - 4
ui/main/center_page.py

@@ -1,11 +1,10 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
-import os
+
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
 from ui.own.palette_theme import set_edt_bg
 from ui.own.palette_theme import set_edt_bg
-from utils.qt import QtWidgets, QtGui, QIcon, QPixmap, Qt, QColor
-from utils.resource import resource_path
+from utils.qt import QtWidgets, Qt, QColor
 from utils.globalvar import SD
 from utils.globalvar import SD
 
 
 
 
@@ -258,7 +257,6 @@ class CenterPage(QtWidgets.QWidget):
         self.mos_ht_warn.setAlignment(Qt.AlignCenter)
         self.mos_ht_warn.setAlignment(Qt.AlignCenter)
         self.mos_ht_warn.setReadOnly(True)
         self.mos_ht_warn.setReadOnly(True)
         set_edt_bg(self.mos_ht_warn, QColor(Qt.gray))
         set_edt_bg(self.mos_ht_warn, QColor(Qt.gray))
-        self.center_qscrollarea_layout.addWidget(self.mos_ht_warn, 3, 0, 1, 1)
 
 
         self.jz_ht_warn = QtWidgets.QLineEdit(self.center_qscrollarea)
         self.jz_ht_warn = QtWidgets.QLineEdit(self.center_qscrollarea)
         self.jz_ht_warn.setText("极柱温度过高告警")
         self.jz_ht_warn.setText("极柱温度过高告警")
@@ -356,10 +354,30 @@ class CenterPage(QtWidgets.QWidget):
         self.dchg_mos_fault.setReadOnly(True)
         self.dchg_mos_fault.setReadOnly(True)
         set_edt_bg(self.dchg_mos_fault, QColor(Qt.gray))
         set_edt_bg(self.dchg_mos_fault, QColor(Qt.gray))
 
 
+        self.afe_high_temp_fault = QtWidgets.QLineEdit(self.center_qscrollarea)
+        self.afe_high_temp_fault.setText("AFE高温告警")
+        self.afe_high_temp_fault.setAlignment(Qt.AlignCenter)
+        self.afe_high_temp_fault.setReadOnly(True)
+        set_edt_bg(self.afe_high_temp_fault, QColor(Qt.gray))
+
+        self.bcu_hard_fault = QtWidgets.QLineEdit(self.center_qscrollarea)
+        self.bcu_hard_fault.setText("从控硬件故障")
+        self.bcu_hard_fault.setAlignment(Qt.AlignCenter)
+        self.bcu_hard_fault.setReadOnly(True)
+        set_edt_bg(self.bcu_hard_fault, QColor(Qt.gray))
+
+        self.glkg_fault = QtWidgets.QLineEdit(self.center_qscrollarea)
+        self.glkg_fault.setText("隔离开关故障")
+        self.glkg_fault.setAlignment(Qt.AlignCenter)
+        self.glkg_fault.setReadOnly(True)
+        set_edt_bg(self.glkg_fault, QColor(Qt.gray))
+
         if SD.CCU_TYPE == 1:
         if SD.CCU_TYPE == 1:
             self.chg_mos_fault.setHidden(True)
             self.chg_mos_fault.setHidden(True)
             self.dchg_mos_fault.setHidden(True)
             self.dchg_mos_fault.setHidden(True)
+            self.mos_ht_warn.setHidden(True)
             self.center_qscrollarea_layout.addWidget(self.cell_fault, 2, 9, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.cell_fault, 2, 9, 1, 1)
+            self.center_qscrollarea_layout.addWidget(self.glkg_fault, 3, 0, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.temp_fault, 3, 4, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.temp_fault, 3, 4, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.temp_up_fault, 3, 5, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.temp_up_fault, 3, 5, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.cell_single_fault, 3, 6, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.cell_single_fault, 3, 6, 1, 1)
@@ -368,9 +386,13 @@ class CenterPage(QtWidgets.QWidget):
             self.center_qscrollarea_layout.addWidget(self.eeprom_fault, 3, 9, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.eeprom_fault, 3, 9, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.soc_fault, 4, 0, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.soc_fault, 4, 0, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.pcs_fault, 4, 2, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.pcs_fault, 4, 2, 1, 1)
+            self.center_qscrollarea_layout.addWidget(self.afe_high_temp_fault, 4, 4, 1, 1)
+            self.center_qscrollarea_layout.addWidget(self.bcu_hard_fault, 4, 5, 1, 1)
         else:
         else:
             self.jump_fault.setHidden(True)
             self.jump_fault.setHidden(True)
             self.ccu_diff_vol_fault.setHidden(True)
             self.ccu_diff_vol_fault.setHidden(True)
+            self.bcu_hard_fault.setHidden(True)
+            self.glkg_fault.setHidden(True)
             self.center_qscrollarea_layout.addWidget(self.mos_ht_warn, 1, 8, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.mos_ht_warn, 1, 8, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.temp_up_fault, 1, 9, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.temp_up_fault, 1, 9, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.pre_chg_fault, 2, 3, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.pre_chg_fault, 2, 3, 1, 1)
@@ -384,6 +406,7 @@ class CenterPage(QtWidgets.QWidget):
             self.center_qscrollarea_layout.addWidget(self.cell_fault, 3, 1, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.cell_fault, 3, 1, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.soc_fault, 3, 2, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.soc_fault, 3, 2, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.pcs_fault, 3, 3, 1, 1)
             self.center_qscrollarea_layout.addWidget(self.pcs_fault, 3, 3, 1, 1)
+            self.center_qscrollarea_layout.addWidget(self.afe_high_temp_fault, 3, 4, 1, 1)
 
 
 
 
         self.center_right_widget = QtWidgets.QWidget(self.center_groupbox)
         self.center_right_widget = QtWidgets.QWidget(self.center_groupbox)

+ 1 - 2
ui/main/main.py

@@ -10,12 +10,11 @@
 '''
 '''
 
 
 
 
-
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
 from ui.main.top_page import TopPage
 from ui.main.top_page import TopPage
 from ui.main.center_page import CenterPage
 from ui.main.center_page import CenterPage
 from ui.main.under_page import UnderPage
 from ui.main.under_page import UnderPage
-from utils.qt import QHBoxLayout, QMetaObject, QVBoxLayout
+from utils.qt import  QMetaObject, QVBoxLayout
 
 
 
 
 class Main(MyFrame):
 class Main(MyFrame):

+ 95 - 43
ui/main/top_page.py

@@ -3,8 +3,7 @@
 
 
 import os
 import os
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from utils.qt import QtWidgets, QtGui, QIcon, QPixmap, Qt
-from utils.resource import resource_path
+from utils.qt import QtWidgets
 from utils.globalvar import SD
 from utils.globalvar import SD
 
 
 
 
@@ -613,9 +612,91 @@ class TopPage(QtWidgets.QWidget):
         self.lb_soc_avg.setText("")
         self.lb_soc_avg.setText("")
         self.soc_avg_layout.addWidget(self.lb_soc_avg)
         self.soc_avg_layout.addWidget(self.lb_soc_avg)
 
 
+        self.nom_energy = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.nom_energy.setTitle("系统标称能量")
+        self.nom_energy_layout = QtWidgets.QHBoxLayout(self.nom_energy)
+        self.lb_nom_energy_value = QtWidgets.QLabel(self.nom_energy)
+        self.lb_nom_energy_value.setText("    ")
+        self.nom_energy_layout.addWidget(self.lb_nom_energy_value)
+        self.lb_nom_energy = QtWidgets.QLabel(self.nom_energy)
+        self.lb_nom_energy.setText("kWh")
+        self.nom_energy_layout.addWidget(self.lb_nom_energy)
+
+        self.all_energy = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.all_energy.setTitle("系统总能量")
+        self.all_energy_layout = QtWidgets.QHBoxLayout(self.all_energy)
+        self.lb_all_energy_value = QtWidgets.QLabel(self.all_energy)
+        self.lb_all_energy_value.setText("    ")
+        self.all_energy_layout.addWidget(self.lb_all_energy_value)
+        self.lb_all_energy = QtWidgets.QLabel(self.all_energy)
+        self.lb_all_energy.setText("kWh")
+        self.all_energy_layout.addWidget(self.lb_all_energy)
+
+        self.afe_temp_high = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.afe_temp_high.setTitle("最高AFE温度值")
+        self.afe_temp_high_layout = QtWidgets.QHBoxLayout(self.afe_temp_high)
+        self.lb_afe_temp_high_value = QtWidgets.QLabel(self.afe_temp_high)
+        self.lb_afe_temp_high_value.setText("    ")
+        self.afe_temp_high_layout.addWidget(self.lb_afe_temp_high_value)
+        self.lb_afe_temp_high = QtWidgets.QLabel(self.afe_temp_high)
+        self.lb_afe_temp_high.setText("℃")
+        self.afe_temp_high_layout.addWidget(self.lb_afe_temp_high)
+
+        self.afe_temp_high_slave = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.afe_temp_high_slave.setTitle("最高AFE温度所在从控ID")
+        self.afe_temp_high_slave_layout = QtWidgets.QHBoxLayout(self.afe_temp_high_slave)
+        self.lb_afe_temp_high_slave_value = QtWidgets.QLabel(self.afe_temp_high_slave)
+        self.lb_afe_temp_high_slave_value.setText("    ")
+        self.afe_temp_high_slave_layout.addWidget(self.lb_afe_temp_high_slave_value)
+        self.lb_afe_temp_high_slave = QtWidgets.QLabel(self.afe_temp_high_slave)
+        self.lb_afe_temp_high_slave.setText("")
+        self.afe_temp_high_slave_layout.addWidget(self.lb_afe_temp_high_slave)
+
+        self.afe_temp_high_slave_in = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.afe_temp_high_slave_in.setTitle("最高AFE温度所在从控内编号")
+        self.afe_temp_high_slave_in_layout = QtWidgets.QHBoxLayout(self.afe_temp_high_slave_in)
+        self.lb_afe_temp_high_slave_in_value = QtWidgets.QLabel(self.afe_temp_high_slave_in)
+        self.lb_afe_temp_high_slave_in_value.setText("    ")
+        self.afe_temp_high_slave_in_layout.addWidget(self.lb_afe_temp_high_slave_in_value)
+        self.lb_afe_temp_high_slave_in = QtWidgets.QLabel(self.afe_temp_high_slave_in)
+        self.lb_afe_temp_high_slave_in.setText("")
+        self.afe_temp_high_slave_in_layout.addWidget(self.lb_afe_temp_high_slave_in)
+
+        self.afe_temp_low = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.afe_temp_low.setTitle("最低AFE温度值")
+        self.afe_temp_low_layout = QtWidgets.QHBoxLayout(self.afe_temp_low)
+        self.lb_afe_temp_low_value = QtWidgets.QLabel(self.afe_temp_low)
+        self.lb_afe_temp_low_value.setText("    ")
+        self.afe_temp_low_layout.addWidget(self.lb_afe_temp_low_value)
+        self.lb_afe_temp_low = QtWidgets.QLabel(self.afe_temp_low)
+        self.lb_afe_temp_low.setText("℃")
+        self.afe_temp_low_layout.addWidget(self.lb_afe_temp_low)
+
+        self.afe_temp_low_slave = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.afe_temp_low_slave.setTitle("最低AFE温度所在从控ID")
+        self.afe_temp_low_slave_layout = QtWidgets.QHBoxLayout(self.afe_temp_low_slave)
+        self.lb_afe_temp_low_slave_value = QtWidgets.QLabel(self.afe_temp_low_slave)
+        self.lb_afe_temp_low_slave_value.setText("    ")
+        self.afe_temp_low_slave_layout.addWidget(self.lb_afe_temp_low_slave_value)
+        self.lb_afe_temp_low_slave = QtWidgets.QLabel(self.afe_temp_low_slave)
+        self.lb_afe_temp_low_slave.setText("")
+        self.afe_temp_low_slave_layout.addWidget(self.lb_afe_temp_low_slave)
+
+        self.afe_temp_low_slave_in = QtWidgets.QGroupBox(self.top_qscrollarea)
+        self.afe_temp_low_slave_in.setTitle("最低AFE温度所在从控内编号")
+        self.afe_temp_low_slave_in_layout = QtWidgets.QHBoxLayout(self.afe_temp_low_slave_in)
+        self.lb_afe_temp_low_slave_in_value = QtWidgets.QLabel(self.afe_temp_low_slave_in)
+        self.lb_afe_temp_low_slave_in_value.setText("    ")
+        self.afe_temp_low_slave_in_layout.addWidget(self.lb_afe_temp_low_slave_in_value)
+        self.lb_afe_temp_low_slave_in = QtWidgets.QLabel(self.afe_temp_low_slave_in)
+        self.lb_afe_temp_low_slave_in.setText("")
+        self.afe_temp_low_slave_in_layout.addWidget(self.lb_afe_temp_low_slave_in)
+
         if SD.CCU_TYPE == 1:
         if SD.CCU_TYPE == 1:
             self.top_qscrollarea_layout.addWidget(self.tv_2, 3, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.tv_2, 3, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.tv_3, 3, 7, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.tv_3, 3, 7, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.nom_energy, 3, 8, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.all_energy, 3, 9, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.jz_temp_high, 4, 5, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.jz_temp_high, 4, 5, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.jz_temp_high_index, 4, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.jz_temp_high_index, 4, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.bcu_temp_high, 4, 7, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.bcu_temp_high, 4, 7, 1, 1)
@@ -626,27 +707,12 @@ class TopPage(QtWidgets.QWidget):
             self.top_qscrollarea_layout.addWidget(self.soc_low, 5, 2, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_low, 5, 2, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_avg, 5, 3, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_avg, 5, 3, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.max_dchg_vol, 5, 4, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.max_dchg_vol, 5, 4, 1, 1)
-            self.nom_energy = QtWidgets.QGroupBox(self.top_qscrollarea)
-            self.nom_energy.setTitle("系统标称能量")
-            self.nom_energy_layout = QtWidgets.QHBoxLayout(self.nom_energy)
-            self.lb_nom_energy_value = QtWidgets.QLabel(self.nom_energy)
-            self.lb_nom_energy_value.setText("    ")
-            self.nom_energy_layout.addWidget(self.lb_nom_energy_value)
-            self.lb_nom_energy = QtWidgets.QLabel(self.nom_energy)
-            self.lb_nom_energy.setText("kWh")
-            self.nom_energy_layout.addWidget(self.lb_nom_energy)
-            self.top_qscrollarea_layout.addWidget(self.nom_energy, 3, 8, 1, 1)
-
-            self.all_energy = QtWidgets.QGroupBox(self.top_qscrollarea)
-            self.all_energy.setTitle("系统总能量")
-            self.all_energy_layout = QtWidgets.QHBoxLayout(self.all_energy)
-            self.lb_all_energy_value = QtWidgets.QLabel(self.all_energy)
-            self.lb_all_energy_value.setText("    ")
-            self.all_energy_layout.addWidget(self.lb_all_energy_value)
-            self.lb_all_energy = QtWidgets.QLabel(self.all_energy)
-            self.lb_all_energy.setText("kWh")
-            self.all_energy_layout.addWidget(self.lb_all_energy)
-            self.top_qscrollarea_layout.addWidget(self.all_energy, 3, 9, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_high, 5, 5, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_high_slave, 5, 6, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_high_slave_in, 5, 7, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_low, 5, 8, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_low_slave, 5, 9, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_low_slave_in, 6, 0, 1, 1)
         else:
         else:
             self.tv_2.setHidden(True)
             self.tv_2.setHidden(True)
             self.tv_3.setHidden(True)
             self.tv_3.setHidden(True)
@@ -654,33 +720,19 @@ class TopPage(QtWidgets.QWidget):
             self.jz_temp_high_index.setHidden(True)
             self.jz_temp_high_index.setHidden(True)
             self.bcu_temp_high.setHidden(True)
             self.bcu_temp_high.setHidden(True)
             self.bcu_temp_high_index.setHidden(True)
             self.bcu_temp_high_index.setHidden(True)
-            self.nom_energy = QtWidgets.QGroupBox(self.top_qscrollarea)
-            self.nom_energy.setTitle("系统标称能量")
-            self.nom_energy_layout = QtWidgets.QHBoxLayout(self.nom_energy)
-            self.lb_nom_energy_value = QtWidgets.QLabel(self.nom_energy)
-            self.lb_nom_energy_value.setText("    ")
-            self.nom_energy_layout.addWidget(self.lb_nom_energy_value)
-            self.lb_nom_energy = QtWidgets.QLabel(self.nom_energy)
-            self.lb_nom_energy.setText("kWh")
-            self.nom_energy_layout.addWidget(self.lb_nom_energy)
             self.top_qscrollarea_layout.addWidget(self.nom_energy, 3, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.nom_energy, 3, 6, 1, 1)
-
-            self.all_energy = QtWidgets.QGroupBox(self.top_qscrollarea)
-            self.all_energy.setTitle("系统总能量")
-            self.all_energy_layout = QtWidgets.QHBoxLayout(self.all_energy)
-            self.lb_all_energy_value = QtWidgets.QLabel(self.all_energy)
-            self.lb_all_energy_value.setText("    ")
-            self.all_energy_layout.addWidget(self.lb_all_energy_value)
-            self.lb_all_energy = QtWidgets.QLabel(self.all_energy)
-            self.lb_all_energy.setText("kWh")
-            self.all_energy_layout.addWidget(self.lb_all_energy)
             self.top_qscrollarea_layout.addWidget(self.all_energy, 3, 7, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.all_energy, 3, 7, 1, 1)
-
             self.top_qscrollarea_layout.addWidget(self.mos_temp_1, 3, 8, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.mos_temp_1, 3, 8, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.mos_temp_2, 3, 9, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.mos_temp_2, 3, 9, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_high, 4, 5, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_high, 4, 5, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_low, 4, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_low, 4, 6, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_avg, 4, 7, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.soc_avg, 4, 7, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.max_dchg_vol, 4, 8, 1, 1)
             self.top_qscrollarea_layout.addWidget(self.max_dchg_vol, 4, 8, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_high, 4, 9, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_high_slave, 5, 0, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_high_slave_in, 5, 1, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_low, 5, 2, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_low_slave, 5, 3, 1, 1)
+            self.top_qscrollarea_layout.addWidget(self.afe_temp_low_slave_in, 5, 4, 1, 1)
         self.top_layout.addWidget(self.top_groupbox)
         self.top_layout.addWidget(self.top_groupbox)
         self.verticalLayout.addWidget(self.top_widget)
         self.verticalLayout.addWidget(self.top_widget)

+ 1 - 2
ui/main/under_page.py

@@ -4,8 +4,7 @@
 import os
 import os
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
 from ui.own.palette_theme import set_edt_bg
 from ui.own.palette_theme import set_edt_bg
-from utils.qt import QtWidgets, QtGui, QIcon, QPixmap, Qt, QColor
-from utils.resource import resource_path
+from utils.qt import QtWidgets, Qt, QColor
 from utils.globalvar import SD
 from utils.globalvar import SD
 
 
 
 

+ 0 - 257
ui/own/led.py

@@ -1,257 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@文件    :led.py
-@时间    :2022/01/14 09:31:20
-@作者    :None
-@版本    :2.0
-@说明    :LED灯
-'''
-
-
-# from numpy import array, uint8
-from utils.qt import QApplication, QColor, QSize, QPushButton
-
-
-class Led(QPushButton):
-    black = QColor(0x00, 0x00, 0x00)
-    white = QColor(0xff, 0xff, 0xff)
-    blue = QColor(0x73, 0xce, 0xf4)
-    green = QColor(0xad, 0xff, 0x2f)
-    orange = QColor(0xff, 0xa5, 0x00)
-    purple = QColor(0xaf, 0x00, 0xff)
-    red = QColor(0xf4, 0x37, 0x53)
-    yellow = QColor(0xff, 0xff, 0x00)
-
-    capsule = 1
-    circle = 2
-    rectangle = 3
-
-    def __init__(self, parent, first_color=green, second_color=red, third_color=yellow, off_color=black, shape=circle):
-        super().__init__()
-
-        self._qss = 'QPushButton {{ \
-                                   border: 3px solid lightgray; \
-                                   border-radius: {}px; \
-                                   background-color: \
-                                       QLinearGradient( \
-                                           y1: 0, y2: 1, \
-                                           stop: 0 white, \
-                                           stop: 0.2 #{}, \
-                                           stop: 0.8 #{}, \
-                                           stop: 1 #{} \
-                                       ); \
-                                 }}'
-        self._first_qss = ''
-        self._second_qss = ''
-        self._third_qss = ''
-        self._off_qss = ''
-
-        self._status = 0
-        self._end_radius = 0
-
-        # Properties that will trigger changes on qss.
-        self.__first_color = None
-        self.__second_color = None
-        self.__third_color = None
-        self.__off_color = None
-        self.__shape = None
-        self.__height = 0
-
-        self._first_color = first_color
-        self._second_color = second_color
-        self._third_color = third_color
-        self._off_color = off_color
-        self._shape = shape
-        self._height = self.sizeHint().height()
-
-    # =================================================== Reimplemented Methods
-    def sizeHint(self):
-        res_h = QApplication.desktop().screenGeometry().height()
-        # res_w = QApplication.desktop().screenGeometry().width()
-
-        # res_w, res_h = pyautogui.size()  # Available resolution geometry
-        if self._shape == Led.capsule:
-            base_w = 50
-            base_h = 30
-        elif self._shape == Led.circle:
-            base_w = 30
-            base_h = 30
-        elif self._shape == Led.rectangle:
-            base_w = 40
-            base_h = 30
-
-        width = int(base_w * res_h / 1080)
-        height = int(base_h * res_h / 1080)
-        return QSize(width, height)
-
-    def resizeEvent(self, event):
-        self._height = self.size().height()
-        QPushButton.resizeEvent(self, event)
-
-    def setFixedSize(self, width, height):
-        self._height = height
-        if self._shape == Led.circle:
-            QPushButton.setFixedSize(self, height, height)
-        else:
-            QPushButton.setFixedSize(self, width, height)
-
-    # ============================================================== Properties
-    # 一级故障
-    @property
-    def _first_color(self):
-        return self.__first_color
-
-    @_first_color.setter
-    def _first_color(self, color):
-        self.__first_color = color
-        self._update_first_qss()
-
-    @_first_color.deleter
-    def _first_color(self):
-        del self.__first_color
-
-    # 二级故障
-    @property
-    def _second_color(self):
-        return self.__second_color
-
-    @_second_color.setter
-    def _second_color(self, color):
-        self.__second_color = color
-        self._update_second_qss()
-
-    @_second_color.deleter
-    def _second_color(self):
-        del self.__second_color
-
-    # 三级故障
-    @property
-    def _third_color(self):
-        return self.__third_color
-
-    @_third_color.setter
-    def _third_color(self, color):
-        self.__third_color = color
-        self._update_third_qss()
-
-    @_third_color.deleter
-    def _third_color(self):
-        del self.__third_color
-
-    # 无故障
-    @property
-    def _off_color(self):
-        return self.__off_color
-
-    @_off_color.setter
-    def _off_color(self, color):
-        self.__off_color = color
-        self._update_off_qss()
-
-    @_off_color.deleter
-    def _off_color(self):
-        del self.__off_color
-
-    @property
-    def _shape(self):
-        return self.__shape
-
-    @_shape.setter
-    def _shape(self, shape):
-        self.__shape = shape
-        self._update_end_radius()
-        self._update_first_qss()
-        self._update_second_qss()
-        self._update_third_qss()
-        self._update_off_qss()
-        self.set_status(self._status)
-
-    @_shape.deleter
-    def _shape(self):
-        del self.__shape
-
-    @property
-    def _height(self):
-        return self.__height
-
-    @_height.setter
-    def _height(self, height):
-        self.__height = height
-        self._update_end_radius()
-        self._update_first_qss()
-        self._update_second_qss()
-        self._update_third_qss()
-        self._update_off_qss()
-        self.set_status(self._status)
-
-    @_height.deleter
-    def _height(self):
-        del self.__height
-
-    # ================================================================= Methods
-    def _update_first_qss(self):
-        color, grad = self._get_gradient(self.__first_color)
-        self._first_qss = self._qss.format(self._end_radius, grad, color, color)
-
-    def _update_second_qss(self):
-        color, grad = self._get_gradient(self.__second_color)
-        self._second_qss = self._qss.format(self._end_radius, grad, color, color)
-
-    def _update_third_qss(self):
-        color, grad = self._get_gradient(self.__third_color)
-        self._third_qss = self._qss.format(self._end_radius, grad, color, color)
-
-    def _update_off_qss(self):
-        color, grad = self._get_gradient(self.__off_color)
-        self._off_qss = self._qss.format(self._end_radius, grad, color, color)
-
-    def _get_gradient(self, color):
-        grad = QColor(int((self.white.red() - color.red()) / 2) + color.red(), int((self.white.green() - color.green()) / 2) + color.green(), int((self.white.blue() - color.blue()) / 2) + color.blue())
-        grad = '{:02X}{:02X}{:02X}'.format(grad.red(), grad.green(), grad.blue())
-        color = '{:02X}{:02X}{:02X}'.format(color.red(), color.green(), color.blue())
-        return color, grad
-
-    def _update_end_radius(self):
-        if self.__shape == Led.rectangle:
-            self._end_radius = int(self.__height / 10)
-        else:
-            self._end_radius = int(self.__height / 2)
-
-    def _toggle_first(self):
-        self.setStyleSheet(self._first_qss)
-
-    def _toggle_second(self):
-        self.setStyleSheet(self._second_qss)
-
-    def _toggle_third(self):
-        self.setStyleSheet(self._third_qss)
-
-    def _toggle_off(self):
-        self.setStyleSheet(self._off_qss)
-
-    def set_first_color(self, color):
-        self._first_color = color
-
-    def set_second_color(self, color):
-        self._second_color = color
-
-    def set_third_color(self, color):
-        self._third_color = color
-
-    def set_off_color(self, color):
-        self._off_color = color
-
-    def set_shape(self, shape):
-        self._shape = shape
-
-    def set_status(self, status):
-        self._status = status
-        if self._status == 0:
-            self._toggle_off()
-        elif self._status == 1:
-            self._toggle_first()
-        elif self._status == 2:
-            self._toggle_second()
-        else:
-            self._toggle_third()

+ 0 - 63
ui/own/my_chart_view.py

@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@文件    :my_chart_view.py
-@时间    :2022/03/14 12:31:02
-@作者    :None
-@版本    :1.0
-@说明    : 重写QChartView 方法,增加缩放功能
-'''
-
-
-from math import pow
-from utils. qt import Qt, QChartView, QPoint, QPointF
-
-
-class MyChartView(QChartView):
-    m_bMiddleButtonPressed = 0
-    m_oPrePos = QPoint()
-
-    def __init__(self, parent=None):
-        super(MyChartView, self).__init__(parent)
-
-    def mouseMoveEvent(self, event):
-        if self.m_bMiddleButtonPressed:
-            oDeltaPos = event.pos() - self.m_oPrePos
-            self.chart().scroll(-oDeltaPos.x(), 0)
-            self.m_oPrePos = event.pos()
-        super(MyChartView, self).mouseMoveEvent(event)
-
-    def mousePressEvent(self, event):
-        if event.button() == Qt.MiddleButton:
-            self.m_bMiddleButtonPressed = True
-            self.m_oPrePos = event.pos()
-            self.setCursor(Qt.OpenHandCursor)
-        super(MyChartView, self).mousePressEvent(event)
-
-    def mouseReleaseEvent(self, event):
-        if event.button() == Qt.MiddleButton:
-            self.m_bMiddleButtonPressed = False
-            self.setCursor(Qt.ArrowCursor)
-        super(MyChartView, self).mouseReleaseEvent(event)
-
-    def wheelEvent(self, event):
-        # 设置比例
-        rVal = pow(0.999, event.delta())
-        # 1. 读取视图基本信息
-        oPlotAreaRect = self.chart().plotArea()
-        oCenterPoint = oPlotAreaRect.center()
-        # 2. 水平调整
-        oPlotAreaRect.setWidth(oPlotAreaRect.width() * rVal)
-        # 3. 竖直调整
-        oPlotAreaRect.setHeight(oPlotAreaRect.height() * rVal)
-        # 4.1 计算视点,视点不变,围绕中心缩放
-        # QPointF oNewCenterPoint(oCenterPoint);
-        #  4.2 计算视点,让鼠标点击的位置移动到窗口中心
-        # QPointF oNewCenterPoint(pEvent->pos());
-        #  4.3 计算视点,让鼠标点击的位置尽量保持不动(等比换算,存在一点误差)
-        oNewCenterPoint = QPointF(2 * oCenterPoint - event.pos() - (oCenterPoint - event.pos()) / rVal)
-        #  5. 设置视点
-        oPlotAreaRect.moveCenter(oNewCenterPoint)
-        #  6. 提交缩放调整
-        self.chart().zoomIn(oPlotAreaRect)
-        super(MyChartView, self).wheelEvent(event)

+ 0 - 58
ui/own/troublebar.py

@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@文件    :troublebar.py
-@时间    :2022/01/22 10:06:04
-@作者    :None
-@版本    :1.0
-@说明    :故障主题
-'''
-
-
-from utils.qt import QProgressBar, QPainter
-# from random import randint
-
-StyleSheet = """
-/*设置红色进度条*/
-#RedProgressBar {
-    text-align: center; /*进度值居中*/
-}
-#RedProgressBar::chunk {
-    background-color: #F44336;
-}
-#GreenProgressBar {
-    min-height: 12px;
-    max-height: 12px;
-    border-radius: 6px;
-}
-#GreenProgressBar::chunk {
-    border-radius: 6px;
-    background-color: #009688;
-}
-#BlueProgressBar {
-    border: 2px solid #2196F3;/*边框以及边框颜色*/
-    border-radius: 5px;
-    background-color: #E0E0E0;
-}
-BlueProgressBar::chunk {
-    background-color: #2196F3;
-    width: 10px; /*区块宽度*/
-    margin: 0.5px;
-}
-"""
-
-
-class TroubleProgressBar(QProgressBar):
-
-    def __init__(self, parent=None):
-        super(TroubleProgressBar, self).__init__(parent)
-        self.setTextVisible(False)
-        self.setStyleSheet("QProgressBar::chunk{background:qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0.0 green, stop: 0 yellow, stop: 1 red)}")
-
-    def paintEvent(self, event):
-        """绘制按钮"""
-        super(TroubleProgressBar, self).paintEvent(event)
-        # 绘制准备工作,启用反锯齿
-        # 创建绘制器并设置抗锯齿和图片流畅转换
-        painter = QPainter(self)
-        painter.setRenderHints(QPainter.Antialiasing | QPainter.TextAntialiasing)

+ 52 - 2
ui/protect.py

@@ -37,9 +37,9 @@ class Protect(MyFrame):
         self.protect_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
         self.protect_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
         self.protect_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
         self.protect_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
         self.protect_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
         self.protect_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
-        self.protect_table.setRowCount(76)
+        self.protect_table.setRowCount(81)
 
 
-        for i in range(76):
+        for i in range(81):
             item = QtWidgets.QTableWidgetItem("N/A")
             item = QtWidgets.QTableWidgetItem("N/A")
             item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
             item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
             self.protect_table.setItem(i, 1, item)
             self.protect_table.setItem(i, 1, item)
@@ -828,6 +828,56 @@ class Protect(MyFrame):
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         self.protect_table.setItem(75, 6, item)
         self.protect_table.setItem(75, 6, item)
 
 
+        item = QtWidgets.QTableWidgetItem("当前允许放电限制电压")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(76, 0, item)
+        item = QtWidgets.QTableWidgetItem("V")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(76, 2, item)
+        item = QtWidgets.QTableWidgetItem("0.1")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(76, 6, item)
+
+        item = QtWidgets.QTableWidgetItem("AFE高温三级告警")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(77, 0, item)
+        item = QtWidgets.QTableWidgetItem("℃")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(77, 2, item)
+        item = QtWidgets.QTableWidgetItem("1")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(77, 6, item)
+
+        item = QtWidgets.QTableWidgetItem("AFE高温二级告警")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(78, 0, item)
+        item = QtWidgets.QTableWidgetItem("℃")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(78, 2, item)
+        item = QtWidgets.QTableWidgetItem("1")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(78, 6, item)
+
+        item = QtWidgets.QTableWidgetItem("AFE高温一级告警")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(79, 0, item)
+        item = QtWidgets.QTableWidgetItem("℃")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(79, 2, item)
+        item = QtWidgets.QTableWidgetItem("1")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(79, 6, item)
+
+        item = QtWidgets.QTableWidgetItem("AFE高温恢复回差阈值")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(80, 0, item)
+        item = QtWidgets.QTableWidgetItem("℃")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(80, 2, item)
+        item = QtWidgets.QTableWidgetItem("1")
+        item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
+        self.protect_table.setItem(80, 6, item)
+
         # item = QtWidgets.QTableWidgetItem("单体过压三级告警")
         # item = QtWidgets.QTableWidgetItem("单体过压三级告警")
         # item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         # item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
         # self.protect_table.setItem(0, 0, item)
         # self.protect_table.setItem(0, 0, item)

+ 1 - 2
ui/set.py

@@ -2,8 +2,7 @@
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 
 
 from ui.own.frame_theme import MyFrame
 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
 
 
 
 
 class Set(MyFrame):
 class Set(MyFrame):

+ 0 - 1
ui/statusbar.py

@@ -11,7 +11,6 @@
 
 
 from utils.qt import QStatusBar, QLabel, QFrame, QProgressBar, QMetaObject, QCoreApplication, QRadioButton, QButtonGroup, Qt
 from utils.qt import QStatusBar, QLabel, QFrame, QProgressBar, QMetaObject, QCoreApplication, QRadioButton, QButtonGroup, Qt
 from utils.globalvar import SD
 from utils.globalvar import SD
-from ui.own.led import Led
 
 
 
 
 class UiStatusBar(object):
 class UiStatusBar(object):

+ 1 - 1
utils/can.py

@@ -16,7 +16,7 @@ from sys import platform
 import ctypes
 import ctypes
 from ctypes import c_ubyte, c_uint, c_ushort, c_char
 from ctypes import c_ubyte, c_uint, c_ushort, c_char
 from utils.qt import QDateTime
 from utils.qt import QDateTime
-from utils.resource import resource_path, resource_path_extend
+from utils.resource import resource_path
 
 
 if platform == "win64":
 if platform == "win64":
     zlg_can_dll = resource_path("config\\ControlCAN.dll")
     zlg_can_dll = resource_path("config\\ControlCAN.dll")

+ 0 - 32
utils/delay.py

@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@文件    :delay.py
-@时间    :2022/02/17 15:37:43
-@作者    :None
-@版本    :1.0
-@说明    :精确到ms延迟函数
-'''
-
-
-import sys
-import ctypes
-from time import sleep
-
-
-def m_delay(ms):
-    if sys.platform == "darwin" or sys.platform == "linux":
-        sleep(ms / 1000)
-    elif sys.platform == "win32" or sys.platform == "win64":
-        stop_value = ctypes.c_longlong(0)
-        start_value = ctypes.c_longlong(0)
-        freq = ctypes.c_longlong(0)
-        n = 0
-        ctypes.windll.kernel32.QueryPerformanceFrequency(ctypes.byref(freq))
-        count = ms * freq.value / 1000
-        ctypes.windll.kernel32.QueryPerformanceCounter(ctypes.byref(start_value))
-        while n < count:
-            ctypes.windll.kernel32.QueryPerformanceCounter(ctypes.byref(stop_value))
-            n = stop_value.value - start_value.value
-    else:
-        sleep(ms / 1000)

+ 2 - 2
utils/globalvar.py

@@ -7,10 +7,10 @@
 @版本    :1.0
 @版本    :1.0
 @说明    :全局变量
 @说明    :全局变量
 '''
 '''
-from utils.qt import QMutex, QSemaphore
-from utils.can import MessageDeal
 
 
 
 
+from utils.can import MessageDeal
+
 class SD:
 class SD:
 
 
     MAJOR_VERSION_NUMBER = 0
     MAJOR_VERSION_NUMBER = 0

+ 0 - 28
utils/log_signal.py

@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-'''
-@文件    :log_signal.py
-@时间    :2022/02/17 15:37:11
-@作者    :None
-@版本    :1.0
-@说明    : 日志打印实例/单例模式
-'''
-
-from utils.qt import Signal, QObject
-
-
-class LogSignal(QObject):
-    instance = None
-    signal = Signal(str)
-
-    @classmethod
-    def print_log_signal(cls):
-        if cls.instance:
-            return cls.instance
-        else:
-            obj = cls()
-            cls.instance = obj
-            return cls.instance
-
-    def log_emit(self, data):
-        self.signal.emit(data)

+ 1 - 2
widget/bms_balance.py

@@ -4,9 +4,8 @@
 
 
 from ui.balance import Balance
 from ui.balance import Balance
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QMessageBox, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import QMessageBox, Signal
 
 
 
 
 class Win_Balance(Balance, MyFrame):
 class Win_Balance(Balance, MyFrame):

+ 1 - 2
widget/bms_cell.py

@@ -4,9 +4,8 @@
 
 
 from ui.cell import Cell
 from ui.cell import Cell
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QLineSeries, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import Signal
 
 
 
 
 class Win_Cell(Cell, MyFrame):
 class Win_Cell(Cell, MyFrame):

+ 1 - 2
widget/bms_double_ccu.py

@@ -3,9 +3,8 @@
 
 
 from ui.double_ccu import DoubleCcu
 from ui.double_ccu import DoubleCcu
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QLineSeries, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import Signal
 
 
 
 
 class Win_Double_Ccu(DoubleCcu, MyFrame):
 class Win_Double_Ccu(DoubleCcu, MyFrame):

+ 1 - 2
widget/bms_download.py

@@ -4,9 +4,8 @@
 
 
 from ui.download import Download
 from ui.download import Download
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QMessageBox, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import QMessageBox, Signal
 
 
 
 
 class Win_Download(Download, MyFrame):
 class Win_Download(Download, MyFrame):

+ 1 - 2
widget/bms_hard.py

@@ -4,9 +4,8 @@
 
 
 from ui.hard import Hard
 from ui.hard import Hard
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QMessageBox, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import QMessageBox, Signal
 from functools import partial
 from functools import partial
 
 
 class Win_Hard(Hard, MyFrame):
 class Win_Hard(Hard, MyFrame):

+ 1 - 3
widget/bms_home.py

@@ -11,9 +11,7 @@
 
 
 from utils.globalvar import SD
 from utils.globalvar import SD
 from ui.home import UiBmsHomePage
 from ui.home import UiBmsHomePage
-from utils.hex_bit import bcd_hex
-from utils.log_signal import LogSignal
-from utils.qt import QMainWindow, Qt, QStyle, QMessageBox, QGuiApplication, QTimer, QDateTime, Signal
+from utils.qt import QMainWindow, Qt, QStyle, QMessageBox, QGuiApplication, Signal
 
 
 
 
 class Win_GotionBMS(UiBmsHomePage, QMainWindow):
 class Win_GotionBMS(UiBmsHomePage, QMainWindow):

+ 1 - 1
widget/bms_login.py

@@ -11,7 +11,7 @@
 
 
 from ui.login import UiBmsLoginPage
 from ui.login import UiBmsLoginPage
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from utils.qt import QMessageBox, Qt, Signal, Slot
+from utils.qt import QMessageBox, Signal, Slot
 from utils.globalvar import SD
 from utils.globalvar import SD
 
 
 
 

+ 1 - 2
widget/bms_main.py

@@ -4,9 +4,8 @@
 
 
 from ui.main.main import Main
 from ui.main.main import Main
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QMessageBox, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import QMessageBox, Signal
 
 
 
 
 class Win_Main(Main, MyFrame):
 class Win_Main(Main, MyFrame):

+ 1 - 2
widget/bms_protect.py

@@ -4,9 +4,8 @@
 
 
 from ui.protect import Protect
 from ui.protect import Protect
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QMessageBox, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import QMessageBox, Signal
 
 
 
 
 class Win_Protect(Protect, MyFrame):
 class Win_Protect(Protect, MyFrame):

+ 1 - 2
widget/bms_record.py

@@ -4,9 +4,8 @@
 
 
 from ui.record import Record
 from ui.record import Record
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.qt import QFileDialog, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
+from utils.qt import QFileDialog, Signal
 
 
 
 
 class Win_Record(Record, MyFrame):
 class Win_Record(Record, MyFrame):

+ 0 - 4
widget/bms_set.py

@@ -4,10 +4,6 @@
 
 
 from ui.set import Set
 from ui.set import Set
 from ui.own.frame_theme import MyFrame
 from ui.own.frame_theme import MyFrame
-from ui.own.my_chart_view import MyChartView
-from utils.globalvar import SD
-from utils.qt import QLineSeries, QChart, QValueAxis, QHBoxLayout, QPainter, Qt, Signal, Slot, QLegendMarker
-
 
 
 class Win_Set(Set, MyFrame):
 class Win_Set(Set, MyFrame):
 
 

+ 7 - 213
worker/bms_work.py

@@ -1,103 +1,16 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
 # -*- encoding: utf-8 -*-
 # -*- encoding: utf-8 -*-
 '''
 '''
-@文件    :ccuWork.py
-@时间    :2021/12/09 08:31:48
-@作者    :None
+@文件    :bms_work.py
+@时间    :2024/03/09 13:28:43
+@作者    :FF
 @版本    :1.0
 @版本    :1.0
-@说明    :二级BMS工作线程
+@邮箱    :[email protected]
+@说明    :BMS工作线程
 '''
 '''
 
 
-from utils.delay import m_delay
 from utils.globalvar import SD
 from utils.globalvar import SD
-from utils.hex_bit import hex_bcd
-from utils.log_signal import LogSignal
-from utils.qt import QObject, Signal, QDateTime
-
-
-class BmsSend(QObject):
-
-    def __init__(self):
-        super(BmsSend, self).__init__()
-        self.page = 1
-
-    def send(self):
-        i = 0
-        while SD.START_RUN:
-            if SD.FRAM_READ_START:
-                if SD.FRAM_SEND_PAGE:
-                    self._fram_read(self.page)
-                    self.page += 1
-                    SD.FRAM_SEND_PAGE = False
-                else:
-                    if SD.FRAM_DELAY_TIME < 10000:
-                        m_delay(1)
-                        SD.FRAM_DELAY_TIME = SD.FRAM_DELAY_TIME + 1
-                    else:
-                        LogSignal.print_log_signal().log_emit("BCMU 铁电数据接收超时重发!" if SD.SYSTEM_LANGUAGE == 0 else "BCMU Fram Timeout!")
-                        self.page -= 1
-                        SD.FRAM_SEND_PAGE = True
-            else:
-                if SD.CCU_CHIP == 0 or SD.CCU_CHIP == 1:
-                    self._run_old()
-                elif SD.CCU_CHIP == 2:
-                    self._run_new(i)
-                    m_delay(100)
-                    self._run_relay(i)
-                    i = i + 1
-                    if i == 256:
-                        i = 0
-                if SD.LIFE_CTL == 2:
-                    self._life_date()
-                m_delay(1000)
-
-    def _fram_read(self, page):
-        data = []
-        if len(data) < 8:
-            data += (8 - len(data)) * [0]
-        data[0] = 0x01
-        data[1] = page & 0xFF
-        data[2] = (page & 0xFF00) >> 8
-        data[3] = 0x01
-        data[4] = 0xFF
-        data[5] = 0xFF
-        data[6] = 0xFF
-        data[7] = 0xFF
-        SD.CAN_CONTROL.send(0x1801B1C1, data, extern_flag=True)
-
-    def _run_old(self):
-        if SD.CCU_CHIP == 0:
-            id = 0x18F403F0
-        elif SD.CCU_CHIP == 1:
-            id = 0x18F403F0 | ((SD.BCU_ID & 0xF0) << 8) | (SD.BCU_ID & 0xF)
-        SD.CAN_CONTROL.send(id, [0x52, 0x55, 0x4E, 0, 0, 0, 0, 0xF5], extern_flag=True)
-
-    def _run_new(self, i):
-        data = []
-        if len(data) < 8:
-            data += (8 - len(data)) * [0]
-        data[0] = 2
-        data[1] = SD.SINGLE_ACQUISITION_OR_BALANCE
-        data[6] = i
-        data[7] = data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6]
-
-        SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x0020, data, extern_flag=True)
-
-    def _run_relay(self, i):
-        data = []
-        if len(data) < 8:
-            data += (8 - len(data)) * [0]
-        data[0] = 4
-        data[6] = i
-        data[7] = data[0] + data[1] + data[2] + data[3] + data[4] + data[5] + data[6]
-
-        SD.CAN_CONTROL.send((0x18 << 24) | (SD.BCU_ID << 16) | 0x0020, data, extern_flag=True)
-
-    def _life_date(self):
-        data = []
-        if len(data) < 8:
-            data += (8 - len(data)) * [0x00]
-        SD.CAN_CONTROL.send(0x18FF0000, data, extern_flag=True)
+from utils.qt import QObject, Signal
 
 
 
 
 class BmsReceived(QObject):
 class BmsReceived(QObject):
@@ -266,123 +179,4 @@ class BmsReceived(QObject):
                 # 0023
                 # 0023
                 elif (result[1] ^ 0x18000023) & 0xFFFF == 0:
                 elif (result[1] ^ 0x18000023) & 0xFFFF == 0:
                     self.to_show_0023_signal.emit(result[2], (result[1] >> 16) & 0xFF)
                     self.to_show_0023_signal.emit(result[2], (result[1] >> 16) & 0xFF)
-                    
-    # # 接收数据
-    # def received(self):
-    #     while SD.CAN_ON_OFF:
-    #         restNum = SD.CAN_CONTROL.get_undeal_number()
-    #         if restNum <= 0:
-    #             continue
-    #         revRet = SD.CAN_CONTROL.receive()
-    #         for i in revRet:
-    #             print(i)
-    #             if int(i.RemoteFlag) == 0:
-    #                 print(i.ID)
-    #                 # ID主机号识别
-    #                 if i.ID & 0xFFFF == 1:
-    #                     self.to_show_masterid_signal.emit((i.ID >> 16) & 0xFF)
-    #                 # 0001
-    #                 if i.ID == 0x18000001 | (SD.BCU_ID << 16):
-    #                     self.to_show_0001_signal.emit(i.Data)
-    #                 # 0002  
-    #                 elif i.ID == 0x18000002 | (SD.BCU_ID << 16):
-    #                     self.to_show_0002_signal.emit(i.Data)
-    #                 # 0003
-    #                 elif i.ID == 0x18000003 | (SD.BCU_ID << 16):
-    #                     self.to_show_0003_signal.emit(i.Data)
-    #                 # 0004  
-    #                 elif i.ID == 0x18000004 | (SD.BCU_ID << 16):
-    #                     self.to_show_0004_signal.emit(i.Data)
-    #                 # 0005
-    #                 elif i.ID == 0x18000005 | (SD.BCU_ID << 16):
-    #                     self.to_show_0005_signal.emit(i.Data)
-    #                 # 0006  
-    #                 elif i.ID == 0x18000006 | (SD.BCU_ID << 16):
-    #                     self.to_show_0006_signal.emit(i.Data)
-    #                 # 0007
-    #                 elif i.ID == 0x18000007 | (SD.BCU_ID << 16):
-    #                     self.to_show_0007_signal.emit(i.Data)
-    #                 # 0008
-    #                 elif i.ID == 0x18000008 | (SD.BCU_ID << 16):
-    #                     self.to_show_0008_signal.emit(i.Data)
-    #                 # 0009
-    #                 elif i.ID == 0x18000009 | (SD.BCU_ID << 16):
-    #                     self.to_show_0009_signal.emit(i.Data)
-    #                 # 000A
-    #                 elif i.ID == 0x1800000A | (SD.BCU_ID << 16):
-    #                     self.to_show_000A_signal.emit(i.Data)
-    #                 # 000B
-    #                 elif i.ID == 0x1800000B | (SD.BCU_ID << 16):
-    #                     self.to_show_000B_signal.emit(i.Data)
-    #                 # 000C 
-    #                 elif i.ID == 0x1800000C | (SD.BCU_ID << 16):
-    #                     self.to_show_000C_signal.emit(i.Data)
-    #                 # 000D
-    #                 elif i.ID == 0x1800000D | (SD.BCU_ID << 16):
-    #                     self.to_show_000D_signal.emit(i.Data)
-    #                 # 000E
-    #                 elif i.ID == 0x1800000E | (SD.BCU_ID << 16):
-    #                     self.to_show_000E_signal.emit(i.Data)
-    #                 # 000F
-    #                 elif i.ID == 0x1800000F | (SD.BCU_ID << 16):
-    #                     self.to_show_000F_signal.emit(i.Data)
-    #                 # 0010
-    #                 elif i.ID == 0x18000010 | (SD.BCU_ID << 16):
-    #                     self.to_show_0010_signal.emit(i.Data)
-    #                 # 0011
-    #                 elif i.ID == 0x18000011 | (SD.BCU_ID << 16):
-    #                     self.to_show_0011_signal.emit(i.Data)
-    #                 # 0012
-    #                 elif i.ID == 0x18000012 | (SD.BCU_ID << 16):
-    #                     self.to_show_0012_signal.emit(i.Data)
-    #                 # 0013
-    #                 elif i.ID == 0x18000013 | (SD.BCU_ID << 16):
-    #                     self.to_show_0013_signal.emit(i.Data)
-    #                 # 0014
-    #                 elif i.ID == 0x18000014 | (SD.BCU_ID << 16):
-    #                     self.to_show_0014_signal.emit(i.Data)
-    #                 # 0015
-    #                 elif i.ID == 0x18000015 | (SD.BCU_ID << 16):
-    #                     self.to_show_0015_signal.emit(i.Data)
-    #                 # 0016
-    #                 elif i.ID == 0x18000016 | (SD.BCU_ID << 16):
-    #                     self.to_show_0016_signal.emit(i.Data)
-    #                 # 0017
-    #                 elif i.ID == 0x18000017 | (SD.BCU_ID << 16):
-    #                     self.to_show_0017_signal.emit(i.Data)
-    #                 # 0018
-    #                 elif i.ID == 0x18000018 | (SD.BCU_ID << 16):
-    #                     self.to_show_0018_signal.emit(i.Data)
-    #                 # 0019
-    #                 elif i.ID == 0x18000019 | (SD.BCU_ID << 16):
-    #                     self.to_show_0019_signal.emit(i.Data)
-    #                 # 001A
-    #                 elif i.ID == 0x1800001A | (SD.BCU_ID << 16):
-    #                     self.to_show_001A_signal.emit(i.Data)
-    #                 # 001B
-    #                 elif i.ID == 0x1800001B | (SD.BCU_ID << 16):
-    #                     self.to_show_001B_signal.emit(i.Data)
-    #                 # 001C
-    #                 elif i.ID == 0x1800001C | (SD.BCU_ID << 16):
-    #                     self.to_show_001C_signal.emit(i.Data)
-    #                 # 001D
-    #                 elif i.ID == 0x1800001D | (SD.BCU_ID << 16):
-    #                     self.to_show_001D_signal.emit(i.Data)
-    #                 # 001E
-    #                 elif i.ID == 0x1800001E | (SD.BCU_ID << 16):
-    #                     self.to_show_001E_signal.emit(i.Data)
-    #                 # 001F
-    #                 elif i.ID == 0x1800001F | (SD.BCU_ID << 16):
-    #                     self.to_show_001F_signal.emit(i.Data)
-    #                 # 0020
-    #                 elif i.ID == 0x18000020 | (SD.BCU_ID << 16):
-    #                     self.to_show_0020_signal.emit(i.Data)
-    #                 # 0021
-    #                 elif i.ID == 0x18000021 | (SD.BCU_ID << 16):
-    #                     self.to_show_0021_signal.emit(i.Data)
-    #                 # 0022
-    #                 elif i.ID == 0x18000022 | (SD.BCU_ID << 16):
-    #                     self.to_show_0022_signal.emit(i.Data)
-    #                 # 0023
-    #                 elif i.ID == 0x18000023 | (SD.BCU_ID << 16):
-    #                     self.to_show_0023_signal.emit(i.Data)
+