|
@@ -1,12 +1,6 @@
|
|
|
#!/usr/bin/env python
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
-'''
|
|
|
-@文件 :bms_home_ctl.py
|
|
|
-@时间 :2022/02/21 16:56:26
|
|
|
-@作者 :None
|
|
|
-@版本 :1.0
|
|
|
-@说明 :主页面 CTL
|
|
|
-'''
|
|
|
+
|
|
|
|
|
|
from controller.bms_cell_ctl import BmsCellControll
|
|
|
from controller.bms_double_ccu_ctl import BmsDoubleCcuControll
|
|
@@ -21,7 +15,7 @@ from model.record_model import RecordModel
|
|
|
from widget.bms_home import Win_GotionBMS
|
|
|
from utils.globalvar import SD
|
|
|
from controller.bms_main_ctl import BmsMainControll
|
|
|
-from utils.qt import QTimer, QThread, QColor, Qt, QDateTime, QtGui, QtWidgets, QPixmap,QApplication
|
|
|
+from utils.qt import QThread, QColor, Qt, QDateTime, QtGui, QtWidgets, QApplication
|
|
|
from utils.hex_bit import a_bit
|
|
|
from worker.bms_work import BmsReceived
|
|
|
from ui.own.palette_theme import set_edt_bg
|
|
@@ -86,18 +80,12 @@ class BmsHomeControll:
|
|
|
if SD.CAN_ON_OFF:
|
|
|
self.bms_status._view.label_bms_connect.setText("通讯已连接" if SD.SYSTEM_LANGUAGE == 0 else "BMS Connected")
|
|
|
SD.START_RUN = True
|
|
|
- # CAN数据发送类
|
|
|
- # self.bms_send_thread = QThread()
|
|
|
- # self.bms_send = BmsSend()
|
|
|
- # self.bms_send.moveToThread(self.bms_send_thread)
|
|
|
- # self.bms_send_thread.started.connect(self.bms_send.send)
|
|
|
# CAN数据接收类
|
|
|
self.bms_received_thread = QThread()
|
|
|
self.bms_received = BmsReceived()
|
|
|
self.bms_received.moveToThread(self.bms_received_thread)
|
|
|
self.bms_received_thread.started.connect(self.bms_received.received)
|
|
|
# 启动线程
|
|
|
- # self.bms_send_thread.start()
|
|
|
self.bms_received_thread.start()
|
|
|
|
|
|
self.bms_received.to_show_masterid_signal.connect(self._get_master_id)
|
|
@@ -148,14 +136,6 @@ class BmsHomeControll:
|
|
|
SD.START_RUN = False
|
|
|
SD.CAN_CONTROL.close_can()
|
|
|
|
|
|
- # if self.bms_send_thread.isRunning():
|
|
|
- # self.bms_send_thread.quit()
|
|
|
- # self.bms_send_thread.wait()
|
|
|
-
|
|
|
- # if self.bms_send_thread.isFinished():
|
|
|
- # del self.bms_send
|
|
|
- # del self.bms_send_thread
|
|
|
-
|
|
|
if self.bms_received_thread.isRunning():
|
|
|
self.bms_received_thread.quit()
|
|
|
self.bms_received_thread.wait()
|
|
@@ -172,7 +152,6 @@ class BmsHomeControll:
|
|
|
|
|
|
|
|
|
def app_cut(self):
|
|
|
- # return
|
|
|
main_window = QApplication.primaryScreen()
|
|
|
pixmap = main_window.grabWindow(QtWidgets.QApplication.desktop().winId())
|
|
|
pixmap.save("screenshot.png");
|
|
@@ -192,41 +171,11 @@ class BmsHomeControll:
|
|
|
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
|
self.bms_double_ccu_ctl._view.on_line_ccu_table.setItem(data - 1, 0, item)
|
|
|
|
|
|
+
|
|
|
def _inf_0000_signal(self, data, id):
|
|
|
if id == SD.BCU_ID:
|
|
|
self._model.ccu_id = SD.BCU_ID
|
|
|
|
|
|
- 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_0001_signal(self, data, id):
|
|
|
- if id == SD.BCU_ID:
|
|
|
# 系统状态
|
|
|
if data[0] & 0x0F == 0x00:
|
|
|
set_edt_bg(self.bms_main_ctl._view.under_widget.sys_status_no, QColor(Qt.green))
|
|
@@ -295,53 +244,54 @@ class BmsHomeControll:
|
|
|
|
|
|
self._model.fault_level = (data[0] & 0x30) >> 4
|
|
|
|
|
|
- # 继电器
|
|
|
- if SD.CCU_TYPE == 1:
|
|
|
- set_edt_bg(self.bms_main_ctl._view.under_widget.do_1, QColor(Qt.gray) if (data[0] & 0x40 == 0) else QColor(Qt.green))
|
|
|
- set_edt_bg(self.bms_main_ctl._view.under_widget.do_2, QColor(Qt.gray) if (data[0] & 0x80 == 0) else QColor(Qt.green))
|
|
|
-
|
|
|
- # SOC
|
|
|
- self.bms_main_ctl._view.top_widget.lb_soc_value.setText(str(round(data[1] * 0.4, 1)))
|
|
|
- self._model.soc = round(data[1] * 0.4, 1)
|
|
|
-
|
|
|
- # 总压
|
|
|
- self.bms_main_ctl._view.top_widget.lb_tv_value.setText(str(round((data[3] << 8 | data[2]) * 0.1, 1)))
|
|
|
- self._model.volt = round((data[3] << 8 | data[2]) * 0.1, 1)
|
|
|
-
|
|
|
- # 电流
|
|
|
- self.bms_main_ctl._view.top_widget.lb_tcur_value.setText(str(round((data[5] << 8 | data[4]) * 0.1 - 3200, 1)))
|
|
|
- self._model.cur = round((data[5] << 8 | data[4]) * 0.1 - 3200, 1)
|
|
|
-
|
|
|
- # SOH
|
|
|
- self.bms_main_ctl._view.top_widget.lb_tsoh_value.setText(str(round(data[6] * 0.4, 1)))
|
|
|
- self._model.soh = round(data[6] * 0.4, 1)
|
|
|
+ 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))
|
|
|
|
|
|
# MOS标志
|
|
|
if SD.CCU_TYPE == 0:
|
|
|
- set_edt_bg(self.bms_main_ctl._view.under_widget.mos_dchg, QColor(Qt.gray) if (data[7] & 0x01 == 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))
|
|
|
-
|
|
|
- # 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))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.mos_dchg, QColor(Qt.gray) if (data[1] & 0x01 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.mos_chg, QColor(Qt.gray) if (data[1] & 0x02 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.mos_pre, QColor(Qt.gray) if (data[1] & 0x04 == 0) else QColor(Qt.green))
|
|
|
|
|
|
# 充电MOS故障
|
|
|
- if a_bit(data[7], 5) == 0:
|
|
|
+ if a_bit(data[1], 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:
|
|
|
+ if a_bit(data[1], 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_dchg, QColor(Qt.gray) if (data[0] & 0x80 == 0) else QColor(Qt.red))
|
|
|
+ if SD.CCU_TYPE == 1:
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_1, QColor(Qt.gray) if (data[2] & 0x01 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_2, QColor(Qt.gray) if (data[2] & 0x02 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_3, QColor(Qt.gray) if (data[2] & 0x04 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_4, QColor(Qt.gray) if (data[2] & 0x08 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_5, QColor(Qt.gray) if (data[2] & 0x10 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_6, QColor(Qt.gray) if (data[2] & 0x20 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_7, QColor(Qt.gray) if (data[2] & 0x40 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.di_8, QColor(Qt.gray) if (data[2] & 0x80 == 0) else QColor(Qt.green))
|
|
|
+
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.do_1, QColor(Qt.gray) if (data[3] & 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[3] & 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[3] & 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[3] & 0x08 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.do_5, QColor(Qt.gray) if (data[3] & 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[3] & 0x20 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.do_7, QColor(Qt.gray) if (data[3] & 0x40 == 0) else QColor(Qt.green))
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.do_8, QColor(Qt.gray) if (data[3] & 0x80 == 0) else QColor(Qt.green))
|
|
|
+ else:
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.fjd_1, QColor(Qt.gray) if (data[4] & 0x01 == 0) else QColor(Qt.green))
|
|
|
+ self._model.gjd_first = data[4] & 0x01
|
|
|
+ set_edt_bg(self.bms_main_ctl._view.under_widget.fjd_1, QColor(Qt.gray) if (data[4] & 0x02 == 0) else QColor(Qt.green))
|
|
|
+ self._model.gjd_second = (data[4] & 0x02) >> 1
|
|
|
|
|
|
# 运行状态
|
|
|
if data[0] & 0x0F == 0x00:
|
|
@@ -359,10 +309,37 @@ class BmsHomeControll:
|
|
|
sys_status = "准备休眠"
|
|
|
else:
|
|
|
sys_status = "无"
|
|
|
+
|
|
|
item = QtWidgets.QTableWidgetItem(sys_status)
|
|
|
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
|
self.bms_double_ccu_ctl._view.on_line_ccu_table.setItem(id - 1, 1, item)
|
|
|
|
|
|
+
|
|
|
+ def _inf_0001_signal(self, data, id):
|
|
|
+ if id == SD.BCU_ID:
|
|
|
+ self._model.ccu_id = SD.BCU_ID
|
|
|
+
|
|
|
+ # SOC
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_soc_value.setText(str(round((data[1] << 8 | data[0]) * 0.01, 2)))
|
|
|
+ self._model.soc = round((data[1] << 8 | data[0]) * 0.01, 2)
|
|
|
+
|
|
|
+ # 总压
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_tv_value.setText(str(round((data[3] << 8 | data[2]) * 0.1, 1)))
|
|
|
+ self._model.volt = round((data[3] << 8 | data[2]) * 0.1, 1)
|
|
|
+
|
|
|
+ # 电流
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_tcur_value.setText(str(round((data[5] << 8 | data[4]) * 0.1 - 3200, 1)))
|
|
|
+ self._model.cur = round((data[5] << 8 | data[4]) * 0.1 - 3200, 1)
|
|
|
+
|
|
|
+ # SOH
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_tsoh_value.setText(str(round((data[7] << 8 | data[6]) * 0.01, 2)))
|
|
|
+ self._model.soh = round((data[7] << 8 | data[6]) * 0.01, 2)
|
|
|
+
|
|
|
+ # SOC
|
|
|
+ item = QtWidgets.QTableWidgetItem(str(round((data[1] << 8 | data[0]) * 0.01, 2)))
|
|
|
+ item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
|
+ self.bms_double_ccu_ctl._view.on_line_ccu_table.setItem(id - 1, 4, item)
|
|
|
+
|
|
|
# 总电压
|
|
|
item = QtWidgets.QTableWidgetItem(str(round((data[3] << 8 | data[2]) * 0.1, 1)))
|
|
|
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
@@ -373,13 +350,8 @@ class BmsHomeControll:
|
|
|
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
|
self.bms_double_ccu_ctl._view.on_line_ccu_table.setItem(id - 1, 3, item)
|
|
|
|
|
|
- # SOC
|
|
|
- item = QtWidgets.QTableWidgetItem(str(round(data[1] * 0.4, 1)))
|
|
|
- item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
|
- self.bms_double_ccu_ctl._view.on_line_ccu_table.setItem(id - 1, 4, item)
|
|
|
-
|
|
|
# SOH
|
|
|
- item = QtWidgets.QTableWidgetItem(str(round(data[6] * 0.4, 1)))
|
|
|
+ item = QtWidgets.QTableWidgetItem(str(round((data[7] << 8 | data[6]) * 0.01, 2)))
|
|
|
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
|
|
|
self.bms_double_ccu_ctl._view.on_line_ccu_table.setItem(id - 1, 5, item)
|
|
|
|
|
@@ -888,14 +860,14 @@ class BmsHomeControll:
|
|
|
def _inf_000A_signal(self, data, id):
|
|
|
if id == SD.BCU_ID:
|
|
|
# 最高单体SOC
|
|
|
- self.bms_main_ctl._view.top_widget.lb_soc_high_value.setText(str(round((data[1] << 8 | data[0]) * 0.4, 1)))
|
|
|
- self._model.max_soc = round((data[1] << 8 | data[0]) * 0.4, 1)
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_soc_high_value.setText(str(round((data[1] << 8 | data[0]) * 0.01, 1)))
|
|
|
+ self._model.max_soc = round((data[1] << 8 | data[0]) * 0.01, 1)
|
|
|
# 最低单体SOC
|
|
|
- self.bms_main_ctl._view.top_widget.lb_soc_low_value.setText(str(round((data[3] << 8 | data[2]) * 0.4, 1)))
|
|
|
- self._model.min_soc = round((data[3] << 8 | data[2]) * 0.4, 1)
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_soc_low_value.setText(str(round((data[3] << 8 | data[2]) * 0.01, 1)))
|
|
|
+ self._model.min_soc = round((data[3] << 8 | data[2]) * 0.01, 1)
|
|
|
# 平均单体SOC
|
|
|
- self.bms_main_ctl._view.top_widget.lb_soc_avg_value.setText(str(round((data[5] << 8 | data[4]) * 0.4, 1)))
|
|
|
- self._model.avg_soc = round((data[5] << 8 | data[4]) * 0.4, 1)
|
|
|
+ self.bms_main_ctl._view.top_widget.lb_soc_avg_value.setText(str(round((data[5] << 8 | data[4]) * 0.01, 1)))
|
|
|
+ self._model.avg_soc = round((data[5] << 8 | data[4]) * 0.01, 1)
|
|
|
# 循环次数
|
|
|
self.bms_main_ctl._view.top_widget.lb_circle_num_value.setText(str(data[7] << 8 | data[6]))
|
|
|
|
|
@@ -1196,44 +1168,45 @@ class BmsHomeControll:
|
|
|
set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 1).widget(), QtGui.QColor(Qt.red))
|
|
|
else:
|
|
|
set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 1).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[2], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 9).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 9).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[3], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 17).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 17).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[4], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 25).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 25).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[2], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 9).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 9).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[3], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 17).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 17).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[4], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 25).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 25).widget(), QtGui.QColor(Qt.white))
|
|
|
|
|
|
|
|
|
def _inf_001B_signal(self, data, id):
|
|
|
if id == SD.BCU_ID:
|
|
|
- # 电池均衡故障
|
|
|
- for i in range(8):
|
|
|
- if a_bit(data[1], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 33).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 33).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[2], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 41).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 41).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[3], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 49).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 49).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[4], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 57).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 57).widget(), QtGui.QColor(Qt.white))
|
|
|
- if a_bit(data[5], i + 1) == 1:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 65).widget(), QtGui.QColor(Qt.red))
|
|
|
- else:
|
|
|
- set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 65).widget(), QtGui.QColor(Qt.white))
|
|
|
+ return
|
|
|
+ # # 电池均衡故障
|
|
|
+ # for i in range(8):
|
|
|
+ # if a_bit(data[1], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 33).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 33).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[2], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 41).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 41).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[3], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 49).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 49).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[4], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 57).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 57).widget(), QtGui.QColor(Qt.white))
|
|
|
+ # if a_bit(data[5], i + 1) == 1:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 65).widget(), QtGui.QColor(Qt.red))
|
|
|
+ # else:
|
|
|
+ # set_edt_bg(self.bms_balance_ctl._view.balance_fault_qscrollarea_layout.itemAtPosition(data[0] - 1, i + 65).widget(), QtGui.QColor(Qt.white))
|
|
|
|
|
|
|
|
|
def _inf_001C_signal(self, data, id):
|